Connection Syntax
First up, creating a connection to a data store requires the
instantiation of a connection object. Code for doing this is characterized by
three features:
-
The namespaces containing the appropriate ADO.NET classes must be imported
-
A string variable to hold some information necessary for making the connection is created and filled
-
The connection object is instantiated
Then, once a connection object has been created, the code that
makes use of the connection tends to look like this:
-
The connection is opened
-
Using the connection, data is read from or written to the data store, or a SQL statement is executed
-
The connection is closed
Returning to the start of that list, you won't be surprised to
discover that the ADO.NET classes, like all of the classes in the .NET Framework
class library, are organized into namespaces. A few moments ago, we saw that
ADO.NET provides three ways to access data: the SQL Server .NET data provider,
the OLE DB .NET data provider, and the ODBC .NET data provider. Accordingly,
there are three namespaces, as follows:
-
System.Data.SqlClient contains the classes that comprise the SQL Server .NET data provider
-
System.Data.OleDb contains the classes that comprise the OLE DB .NET data provider
-
System.Data.ODBC contains the classes that comprise the ODBC .NET data provider (note that, as already mentioned, this provider must be downloaded and installed separately)
In addition to these, we'll almost always find ourselves making
use of the System. Data namespace, which contains a large number of classes and
other entities that form the 'backbone' of ADO.NET. The classes in this
namespace are not specific to a particular data provider.
If you are searching life partner. your searching end with kpmarriage.com. now kpmarriage.com offer free matrimonial website which offer free message, free chat, free view contact information. so register here : kpmarriage.com- Free matrimonial website
0 comments:
Post a Comment