Using .NET Framework Data Providers to Access Data
A data provider in the .NET Framework serves as a bridge between an application and a data source. A data provider is used to retrieve data from a data source and to reconcile changes to that data back to the data source.
The following table lists the .NET Framework data providers that are included in the .NET Framework.
|.NET Framework data provider||Description|
|.NET Framework Data Provider for SQL Server||For Microsoft® SQL Server™ version 7.0 or later.|
|.NET Framework Data Provider for OLE DB||For data sources exposed using OLE DB.|
|.NET Framework Data Provider for ODBC||For data sources exposed using ODBC.
Note The .NET Framework Data Provider for ODBC is not included in the .NET Framework version 1.0. If you require the .NET Framework Data Provider for ODBC and are using the .NET Framework version 1.0, you can download the .NET Framework Data Provider for ODBC at http://msdn.microsoft.com/downloads. The namespace for the downloaded .NET Framework Data Provider for ODBC is Microsoft.Data.Odbc.
|.NET Framework Data Provider for Oracle||For Oracle data sources. The .NET Framework Data Provider for Oracle supports Oracle client software version 8.1.7 and later.
Note The .NET Framework Data Provider for Oracle is not included in the .NET Framework version 1.0. If you require the .NET Framework Data Provider for Oracle and are using the .NET Framework version 1.0, you can download the .NET Framework Data Provider for Oracle at http://msdn.microsoft.com/downloads.
The Connection, Command, DataReader, and DataAdapter objects represent the core elements of the .NET Framework data provider model. The following table describes these objects.
|Connection||Establishes a connection to a specific data source.|
|Command||Executes a command against a data source.|
|DataReader||Reads a forward-only, read-only stream of data from a data source.|
|DataAdapter||Populates a DataSet and resolves updates with the data source.|
Along with the core classes listed in the preceding table, a .NET Framework data provider also contains the classes listed in the following table.
|Transaction||Enables you to enlist commands in transactions at the data source.|
|CommandBuilder||A helper object that will automatically generate command properties of a DataAdapter or will derive parameter information from a stored procedure and populate the Parameters collection of a Command object.|
|Parameter||Defines input, output, and return value parameters for commands and stored procedures.|
|Exception||Returned when an error is encountered at the data source. For an error encountered at the client, .NET Framework data providers throw a .NET Framework exception.|
|Error||Exposes the information from a warning or error returned by a data source.|
|ClientPermission||Provided for .NET Framework data provider code access security attributes.|
In This Section
- Connecting to a Data Source Using ADO.NET
Describes the ADO.NET Connection object and how to use it to connect to a data source.
- Executing a Command
Describes the ADO.NET Command object and how to use it to execute queries and commands against a data source.
- Retrieving Data Using the DataReader
Describes the ADO.NET DataReader object and how to use it to return a stream of results from a data source.
- Using Stored Procedures with a Command
Describes how to use the Command object to call a stored procedure, including information about sending and retrieving parameter values.
- Obtaining a Single Value from a Database
Describes how to return a single value from a database query using a Command.
- Obtaining BLOB Values from a Database
Describes how to return a binary large object (BLOB) from a database using a DataReader.
- Writing BLOB Values to a Database
Describes how to store a binary large object (BLOB) in a database.
- Performing Database Operations and Modifying Data
Describes how to use a Command to issue INSERT, UPDATE, and DELETE commands against a data source, as well as how to perform catalog operations such as creating or altering tables.
- Obtaining Data as XML from SQL Server
Describes how to use a Command to return the results of a SQL Server FOR XML query as an XmlReader.
- Populating a DataSet from a DataAdapter
Describes how to fill a DataSet with tables, columns, and rows using a DataAdapter.
- Updating the Database with a DataAdapter and the DataSet
Describes how to resolve changes made to data in a DataSet back to the data source using a DataAdapter.
- Adding Existing Constraints to a DataSet
Describes how to populate the constraints of a DataSet, such as unique constraints for primary key columns, from a data source.
- Setting Up DataTable and DataColumn Mappings
Describes how to use table and column mappings to provide application-specific names for columns returned from a data source.
- Using Parameters with a DataAdapter
Describes how to use parameters with the command properties of a DataAdapter including how to map the contents of a column in a DataSet to a command parameter.
- Input and Output Parameters, and Return Values
Describes how to map the contents of a column in a DataSet table to input and output parameters of a DataAdapter command property, including how to retrieve return values from stored procedures.
- Automatically Generated Commands
Describes how to use the CommandBuilder to automatically generate INSERT, UPDATE, and DELETE commands for a DataAdapter that has a single table SELECT command.
- Working with DataAdapter Events
Describes DataAdapter events and how to use them.
- Obtaining Schema Information from a Database
Explains how to obtain schema information from a data source such as a list of tables in a database or catalog.
- Performing Transactions
Explains how to use the Connection and Transaction objects to perform transactions against a data source or enlist in an existing transaction.
- Code Access Security for .NET Framework Data Providers
Describes the additional code access security permissions available for the .NET Framework data providers provided with the .NET Framework, and how to determine if a particular permission is available for the code you are running.