May 2002
Beginner to intermediate
560 pages
11h 36m
English
The Connection class in connected mode represents a connection to a data store that uses a proprietary protocol. The connection string identifies which data store the user wishes to log on to and identifies the user. (User is an antiquated term in a three-tier scenario; usually, the “user” is a service agent and not the end user.) The following code opens a database connection through the SqlClient and OleDb data providers. This code will look familiar if you've used a data access API.
// open a connection to SQL Server SqlConnection sconn = new SqlConnection( "server=myserver;uid=sam;pwd=tc8!at;database=acme"); sconn.Open(); // open a connection to SQL Server OleDbConnection oconn = new OleDbConnection( "provider=sqloledb;data ...