Microsoft Office Tutorials and References
In Depth Information
Connecting with Microsoft SQL Server 2008 database
// Checks for delimits for text parsing
Excel.XlTextParsingType.xlDelimited,
// Text Enumeration value
Excel.XlTextQualifier.xlTextQualifierNone,
missing, missing, missing, true, missing, missing, missing,
missing, missing, missing, missing, missing, missing);
}
Connecting with Microsoft SQL Server 2008
database
Microsoft SQL Server 2008 is a relational database management system developed by
Microsoft Corporation. Microsoft SQL Server is used to manage a huge volume of data
along with relation and Metadata information for this data. VSTO provides support for
manipulating the data from your database inside Excel using ADO.NET classes.
Microsoft SQL Server 2008
ADO.NET
Excel Object Model
Excel 2007
The preceding figure demonstrates how an Excel 2007 object is used to interact
with the Microsoft SQL Server database. Let's see how to connect with a relational
database management system, retrieve data from the database, and finally display
it in our Excel spreadsheet. This demonstration shows you how to retrieve data
from a Microsoft SQL Server 2008 database and place the retrieved data into the
worksheet cells.
Open Visual Studio 2008 and create a new solution, as usual. Write the following
code inside the ThisWorkbook.cs file.
// Namespace for SQL Server connection
using System.Data.SqlClient;
// Startup event of the workbook
private void ThisWorkbook_Startup(object sender,
System.EventArgs e)
 
Search JabSto ::




Custom Search