Select the product you need help with
How to import data from Microsoft SQL Server into Microsoft ExcelArticle ID: 306125 - View products that this article applies to. This article was previously published under Q306125 On This PageSUMMARY
This step-by-step guide describes how to import data into Microsoft Excel from the Pubs database, a sample database that is included with Microsoft SQL Server. ActiveX Data Objects (ADO) provide access to any type of data source. It is a flat object model with few objects. The main objects in the ADO object model are:
Object Description
-----------------------------------------------------------------------
Connection Refers to the connection to the data source.
Recordset Refers to the data extracted.
Command Refers to a stored procedure or SQL statements that
need to be executed.
RequirementsYou must have a local server running Microsoft SQL Server and containing the Pubs database.Microsoft recommends you have knowledge of the following:
Referencing the ADO object library
Creating the connection
Extracting the dataType or paste the following code to extract your records:Verifying that the code works
TroubleshootingIf your code appears to hang and you receive a run-time error, your database server may be down. You can use the ConnectionTimeout property to control the time it takes to return a run-time error. Set this property to a value greater than zero. If you set the value to zero, the connection will never time out. The default value is 15 seconds.REFERENCES
You can find additional sample code by searching the following Microsoft Web site:
http://msdn.microsoft.com/
(http://msdn.microsoft.com/)
PropertiesArticle ID: 306125 - Last Review: April 19, 2012 - Revision: 7.0
| Article Translations
|


Back to the top








