Mimer SQL Data Provider
Open Method
Example 




Mimer.Data.Client Namespace > MimerConnection Class : Open Method
Opens a connection to a database server with the settings specified in the ConnectionString property.
Syntax
'Declaration
 
Public Overrides NotOverridable Sub Open() 
public override void Open()
public procedure Open(); override; 
public override function Open();
public: void Open(); override 
Exceptions
ExceptionDescription
  • No connection string specified
  • Connection already open
  • Required connect options missing
  • Incompatible connect options specified
Error when setting up connection to database server or during initial communication.
Remarks
You must explicitly close the connection when done with it through the Close or Dispose(Boolean) 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.

If a System.Transactions.TransactionScope is active the Mimer SQL Data Provider will automatically enlist in the transaction unless explicitly disabled with the enlist-option in the ConnectionString.

Example

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 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();
    }
}
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
Requirements

.NET Framework
Version 2.0 or later

See Also

Reference

MimerConnection Class
MimerConnection Members