'Declaration Public Class UniConnection Inherits Devart.Common.DbConnectionBase Implements System.ComponentModel.IComponent, System.ComponentModel.ISupportInitialize, System.Data.IDbConnection, System.ICloneable, System.IDisposable
'Declaration Public Class UniConnection Inherits Devart.Common.DbConnectionBase Implements System.ComponentModel.IComponent, System.ComponentModel.ISupportInitialize, System.Data.IDbConnection, System.ICloneable, System.IDisposable
A UniConnection object represents a unique connection to the server. Use it in conjunction with UniCommand, UniDataReader, UniDataAdapter or other components for convenient interoperation with database.
When you create an instance of UniConnection, all properties are set to their initial values. For a list of these values, see the UniConnection Constructor constructor.
If the UniConnection goes out of scope, it is not closed. Therefore, you must explicitly close the connection by calling Close.
A single UniConnection can be used by many UniCommand objects on the assumption that all operations will be done consecutively. In other words, you can not execute a SQL statement while an asynchronous operation is in progress.
public void InsertRow(string myConnectionString) { // If the connection string is empty, use default. if(myConnectionString == "") { myConnectionString = "Provider=SQL Server;Data Source=SERVER;Initial Catalog=Northwind;User ID=sa"; } UniConnection myConn = new UniConnection(myConnectionString); string myInsertQuery = "INSERT INTO Test.Dept(DeptNo, DName) Values(50, 'DEVELOPMENT')"; UniCommand myCommand = new UniCommand(myInsertQuery); myCommand.Connection = myConn; myConn.Open(); try { myCommand.ExecuteNonQuery(); } finally { myConn.Close(); } }
Public Sub InsertRow(myConnectionString As String) ' If the connection string is empty, use default. If myConnectionString = "" Then myConnectionString = "Provider=SQL Server;Data Source=SERVER;Initial Catalog=Northwind;User ID=sa" End If Dim myConn As New UniConnection(myConnectionString) Dim myInsertQuery As String = "INSERT INTO Test.Dept(DeptNo, DName) Values(50, 'DEVELOPMENT')" Dim myCommand As New UniCommand(myInsertQuery) myCommand.Connection = myConn myConn.Open() Try myCommand.ExecuteNonQuery() Finally myConn.Close() End Try End Sub
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Data.Common.DbConnection
Devart.Common.DbConnectionBase
Devart.Data.Universal.UniConnection
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2