Export (0) Print
Expand All

IDbConnection.ConnectionString Property

Gets or sets the string used to open a database.

Namespace: System.Data
Assembly: System.Data (in system.data.dll)

'Declaration
Property ConnectionString As String
'Usage
Dim instance As IDbConnection
Dim value As String

value = instance.ConnectionString

instance.ConnectionString = value
/** @property */
String get_ConnectionString ()

/** @property */
void set_ConnectionString (String value)

function get ConnectionString () : String

function set ConnectionString (value : String)

Property Value

A string containing connection settings.

The ConnectionString property can be set only while the connection is closed.

The following example creates an instance of a derived class, OleDbConnection, sets its ConnectionString, and displays its State..

Public Sub CreateOleDbConnection()
    Dim connection As New OleDbConnection()
    connection.ConnectionString = _
       "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Northwind.mdb"
    Console.WriteLine("Connection State: " & connection.State.ToString())
End Sub

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2015 Microsoft