10 The Sybase Data Provider : Provider Factories

Provider Factories
When you use the Common Programming Model, you do not need to specify the provider-specific namespace, because the Provider Factories generate instances of the specified data provider. However, if you want to use DataDirect Bulk Copy, you must include the DDTek.Data.Common namespace.
The following C# code snippet obtains an instance of the Sybase data provider:
DbProviderFactory factory = DbProviderFactories.GetFactory("DDTek.Sybase");
DbConnection Conn = factory.createConnection();
Conn.ConnectionString = "Host=Accounting1;Port=4100;
User ID=test01;Password=test01;Database Name=Accounting";
 
try
{
    Conn.Open();
    Console.WriteLine("Connection successful!");
}
catch (Exception ex)
{
    // Connection failed
    Console.WriteLine(ex.Message);
}
// Close the connection
Conn.Close();