OdbcSqlAnywhereDataContext.OdbcSqlAnywhereDataContext(OdbcConnection dbConnection) Constructor
.NET Standard 2.x
Initializes a new instance of the OdbcSqlAnywhereDataContext class by passing the OdbcConnection
type object as a parameter.
Namespace: SnapObjects.Data.Odbc
Assembly: SnapObjects.Data.Odbc.dll
Syntax
public OdbcSqlAnywhereDataContext(OdbcConnection dbConnection) : base(dbConnection, new OdbcSqlAnywhereDataContextOptions(String.Empty))
Parameters
dbConnection
OdbcConnection
The connection object which is an OdbcConnection
instance.
Examples
The following code example uses the OdbcConnection
object to initialize an instance of the OdbcSqlAnywhereDataContext
class.
using SnapObjects.Data.Odbc;
using System;
using System.Data.Odbc;
namespace Appeon.ApiDoc.OdbcSqlAnywhereDataContextExamples
{
public class OdbcSqlAnywhereDataContextExample
{
public void Example2()
{
string asaConnectionString = "Dsn=SQL Anywhere 17 Demo;uid=dba;pwd=sql";
var asaContext = new OdbcSqlAnywhereDataContext(
new OdbcConnection(asaConnectionString));
Console.WriteLine(asaContext.ContextOptions.DatabaseType);
/*This code produces the following output:
Odbc
*/
}
}
}
Applies to
.NET Standard
2.x