Comments/Troubleshooting

All Parameter objects implement the IDbDataParameter and IDataParameter interfaces from the System.Data namespace, and are thus quite similar. Because IDbDataParameter extends IDataParameter, you can use the IDataParameter to access all functionality when writing provider-agnostic data access code.

Provider-specific Parameter objects typically add a property that defines a database-specific data type for the parameter. Some Parameter classes for ADO.NET providers are shown in Table 20-1.

Table 20-1. Provider-specific Parameter classes

Class

Data source

System.Data.SqlClient.SqlParameter

SQL Server

System.Data.OleDb.OleDbParameter

An OLE DB provider

System.Data.Odbc.OdbcParameter

An ODBC driver

System.Data.OleDb.OracleParameter

Oracle

Get ADO.NET in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.