Opens a connection to a database server with the settings specified in the ConnectionString property.
[Visual Basic] Public Sub Open() _ Implements IDbConnection.Open [C#] public void Open(); [C++] public: void Open(); [JScript] public function Open();
You must explicitly close the connection when done with it through the Close or Dispose methods. If the connection object goes out of scope without first closing it, the connection will be pending in the server until the MimerConnection object is garbage collected.
[C#]
MimerConnection connection = new MimerConnection();
//
// Open a connection to node DbNode accessing database server ExampleDB
//
connection.ConnectionString = "Database=ExampleDB;protocol=tcp;node=DbNode;user id=SYSADM;password=syspass";
try {
connection.Open();
//
// Do useful work...
//
} finally {
if (connection.State != ConnectionState.Closed) {
connection.Close();
}
}
[Visual Basic]
Dim connection As New MimerConnection
'
' Open a connection to node DbNode accessing database server ExampleDB
'
connection.ConnectionString = "Database=ExampleDB;protocol=tcp;node=DbNode;user id=SYSADM;password=syspass"
Try
connection.Open()
'
' Do useful work...
'
Finally
If Not connection.State = ConnectionState.Closed Then
connection.Close()
End If
End Try
[C++, JScript] No example is available for C++ or JScript. To view a C# example, click the Language Filter button in the upper-left corner of the page.
MimerConnection Class | Mimer.Data.Client Namespace