Show / Hide Table of Contents

    OdbcSqlAnywhereDataContext.OdbcSqlAnywhereDataContext(IDataContextOptions dataContextOptions) Constructor

    .NET Standard 2.x

    Initializes a new instance of the OdbcSqlAnywhereDataContext class by passing the OdbcSqlAnywhereDataContextOptions type object as a parameter.

    Namespace: SnapObjects.Data.Odbc

    Assembly: SnapObjects.Data.Odbc.dll

    Syntax

    public OdbcSqlAnywhereDataContext(IDataContextOptions dataContextOptions) : base(dataContextOptions)
    

    Parameters

    dataContextOptions SnapObjects.Data.IDataContextOptions

    The options to be set for the DataContext object.

    Examples

    The following code example uses the OdbcSqlAnywhereDataContextOptions 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 Example1()
            {
                string asaConnectionString = "Dsn=SQL Anywhere 17 Demo;uid=dba;pwd=sql";
                
                var asaContext = new OdbcSqlAnywhereDataContext(
                    new OdbcSqlAnywhereDataContextOptions(asaConnectionString));
                    
                Console.WriteLine(asaContext.ContextOptions.DatabaseType);
                
                /*This code produces the following output:
                
                    Odbc
                */
            }
        }
    }
    

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon