Provides a collection of classes used to access an ODBC data source in the managed space Commonly Used Types: System.Data.Odbc.OdbcCommand System.Data.Odbc.OdbcConnection System.Data.Odbc.OdbcDataReader System.Data.Odbc.OdbcDataAdapter System.Data.Odbc.OdbcParameter System.Data.Odbc.OdbcParameterCollection System.Data.Odbc.OdbcTransaction
$ dotnet add package System.Data.OdbcThis package implements a data provider for ODBC data sources.
Allows access to ODBC data sources.
This is a basic example of retrieving the results of a query using an OdbcDataReader. For examples of using an OdbcDataAdapter, and of updating an ODBC data source, please see the documentation.
using System.Data.Odbc;
string connectionString = "";
string queryString = "SELECT DISTINCT CustomerID FROM Orders";
using OdbcConnection connection = new OdbcConnection(connectionString);
using OdbcCommand command = new OdbcCommand(queryString, connection);
connection.Open();
using OdbcDataReader reader = command.ExecuteReader();
while (reader.Read())
{
Console.WriteLine("CustomerID={0}", reader[0]);
}
System.Data.OleDb is a similar package for accessing OLE DB data sources.
System.Data.Odbc is released as open source under the MIT license. Bug reports are welcome at . This package is considered complete and we only consider low-risk, high-impact fixes that are necessary to maintain or improve quality.