[ Team LiB ] Previous Section Next Section

20.1 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

    [ Team LiB ] Previous Section Next Section