OleDbConnection.Provider Property

Definition

Gets the name of the OLE DB provider specified in the "Provider= " clause of the connection string.

C#
[System.ComponentModel.Browsable(true)]
public string Provider { get; }
C#
[System.Data.DataSysDescription("OleDbConnection_Provider")]
public string Provider { get; }

Property Value

The name of the provider as specified in the "Provider= " clause of the connection string. The default value is an empty string.

Attributes

Examples

The following example creates an OleDbConnection and displays some of its read-only properties.

C#
static void OpenConnection(string connectionString)
{
    using (OleDbConnection connection = new OleDbConnection(connectionString))
    {
        try
        {
            connection.Open();
            Console.WriteLine("ServerVersion: {0} \nProvider: {1}",
                connection.ServerVersion, connection.Provider);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
        // The connection is automatically closed when the
        // code exits the using block.
    }
}

Applies to

Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

See also