December 2001
Intermediate to advanced
416 pages
8h 16m
English
All interactions with a database are carried out through a data provider. In Section 5.10 we walked through the OLE DB data provider. This section steps through the analogous use of the SQL Server data provider defined within the System.Data.SqlClient namespace. It can be used with Microsoft SQL Server 7.0 or later versions.
Here are the steps necessary, using the SQL Server data provider, first to connect to and select data from a database, and then to fill a DataSet object with the retrieved data:
1. |
Create a connection string. The string must identify the server, user ID, password, and database—for example,
string cs = "server=localhost;uid=sa;pwd=;database=northwind"; |
2. |
Create a selection command string. This minimally ... |
Read now
Unlock full access