.NET Data Providers
.NET data providers are used for connecting to a RDBMS-specific database (such as SQL Server or Oracle), executing commands, and retrieving results. Those results are either processed directly (via a DataReader) or placed in an ADO.NET DataSet (via a DataAdapter) in order to be exposed to the user in an ad hoc manner, combined with data from multiple sources, or passed around between tiers. .NET data providers are designed to be lightweight, to create a minimal layer between the data source and the .NET programmer's code, and to increase performance while not sacrificing any functionality.
Connection Object
To connect to a specific data source, you use a data connection object. To connect to Microsoft SQL Server 7.0 or later, you need to use the SqlConnection object of the SQL Server .NET data provider. You need to use the OleDbConnection object of the OLE DB .NET data provider to connect to an OLE DB data source, or the OLE DB provider for SQL Server (SQLOLEDB) to connect to versions of Microsoft SQL Server earlier than 7.0.
Connection String Format — OleDbConnection
For the OLE DB .NET data provider, the connection string format is the same as the connection string format used in ADO, with the following exceptions:
- The Provider keyword is required.
- The URL, Remote Provider, and Remote Server keywords are not supported.
Here is an example OleDbConnection connection string connecting to an Access database:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source= "C:\Program ...
Get Professional Visual Basic 2012 and .NET 4.5 Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.