OdbcDataContext.OdbcDataContext(OdbcConnection dbConnection) Constructor
.NET Standard 2.x
Initializes a new instance of the OdbcDataContext class by passing the OdbcConnection
type object as a parameter.
Namespace: SnapObjects.Data.Odbc
Assembly: SnapObjects.Data.Odbc.dll
Syntax
public OdbcDataContext(OdbcConnection dbConnection) : base(dbConnection, new OdbcDataContextOptions(String.Empty))
Parameters
dbConnection
OdbcConnection
The connection object which is an OdbcConnection
instance.
Examples
The following code example uses an OdbcConnection
object to initialize an instance of the OdbcDataContext
class.
using Appeon.ApiDoc.Models;
using Odbc.ManagedDataAccess.Client;
using SnapObjects.Data;
using SnapObjects.Data.Odbc;
using System;
namespace Appeon.ApiDoc.OdbcDataContextExamples
{
public class OdbcDataContextExample
{
public void Example2()
{
DataContext dataContext = new OdbcDataContext(new OdbcConnection(CONNECTION_STRING));
Console.WriteLine(dataContext.ContextOptions.DatabaseType);
/*This code produces the following output:
Odbc
*/
}
}
}
Applies to
.NET Standard
2.x