OleDbConnection.Provider Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the name of the OLE DB provider specified in the "Provider= " clause of the connection string.
public:
property System::String ^ Provider { System::String ^ get(); };
[System.ComponentModel.Browsable(true)]
public string Provider { get; }
[System.Data.DataSysDescription("OleDbConnection_Provider")]
public string Provider { get; }
[<System.ComponentModel.Browsable(true)>]
member this.Provider : string
[<System.Data.DataSysDescription("OleDbConnection_Provider")>]
member this.Provider : string
Public ReadOnly Property Provider As String
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.
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.
}
}
Public Sub OpenConnection(ByVal connectionString As String)
Using connection As New OleDbConnection(connectionString)
Try
connection.Open()
Console.WriteLine("ServerVersion: {0} Provider: {1}", _
connection.ServerVersion, connection.Provider)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
' The connection is automatically closed when the
' code exits the Using block.
End Using
End Sub
Applies to
See also
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET