Initializes a new instance of the AdoConnector class.

public AdoConnector(DbProviderFactory factory, string connection_string = null)

Initializes a new instance with the specified ADO.NET provider factory and connection string.

factory (DBProviderFactory)

The DBProviderFactory represents a set of methods for creating instances of a provider's implementation of the data source classes.

The factory for SQLServer is SqlClientFactory.Instance in the System.Data.SqlClient namespace.

The factory for's SQLite provider is SQLiteFactory.Instance in the System.Data.SQLite namespace.

The factory for CData's Exchange Server provider is ExchangeProviderFactory.Instance in the System.Data.CData.Exchange namespace.

The finding the factory for a provider explains how to find the name of the factory class in a provider's assembly.

connection_string (string)

The connection string contains information used by the ADO.NET provider to connect to a data source.

Click here for examples of connection strings.

It is possible to create an AdoConnector instance with the connection_string set to null. You only do this when you create the instance just to retrieve the ProviderInvariantName property without ever using the AdoConnector to open a database connection.

public AdoConnector(DbProviderFactory factory, string connection_string = null)


An SQLite database in the same folder as the EXE file:

string db_folder = AppDomain.CurrentDomain.BaseDirectory;

string connection_string = $@"Data Source={db_folder}\VanArsdel.db;FailIfMissing=True;";

VenturaConfig.DefaultConnector = new AdoConnector(SQLiteFactory.Instance, connection_string);

SQL Server:

string connection_string = @"Server=.\SQLEXPRESS;Initial Catalog=PlayGround;Connection Timeout=30;Integrated Security=True;MultipleActiveResultSets=True";

VenturaConfig.DefaultConnector = new AdoConnector(SqlClientFactory.Instance, connection_string);