dotConnect for Salesforce Documentation
Devart.Common Namespace / DbConnectionBase Class
Members Example

DbConnectionBase Class
Represents an open connection to a server.
Syntax
'Declaration
 
Public MustInherit Class DbConnectionBase 
   Inherits System.Data.Common.DbConnection
   Implements System.ComponentModel.IComponentSystem.Data.IDbConnectionSystem.IDisposable 
 
Remarks
The abstract DbConnectionBase class implements some of DbConnectionBase functionality that is data source-independent.
Example
The following sample demonstrates how using base classes helps to create data source independent code.
public void PrintDept(DbConnectionBase myConnection) {
	DbCommandBase myCommand = (DbCommandBase)myConnection.CreateCommand();
	myCommand.CommandText = "SELECT Id, Name, Type FROM Account";
	myConnection.Open();
	DbDataReader myReader = myCommand.ExecuteReader();
	try {
		while (myReader.Read()) {
			Console.WriteLine(myReader.GetString(0) + " " + 
				myReader.GetString(1) + " " + myReader.GetString(2));
		}
	}
	finally {
		myReader.Close();
		myConnection.Close();
	}
}
Public Sub PrintDept(ByVal myConnection As DbConnectionBase)
	Dim myCommand As DbCommandBase = myConnection.CreateCommand()
	myCommand.CommandText = "SELECT Id, Name, Type FROM Account"
	myConnection.Open()
	Dim myReader As DbDataReader = myCommand.ExecuteReader()
	Try
		While myReader.Read()
			Console.WriteLine(String.Concat(myReader.GetString(0), " ", _
				myReader.GetString(1), " ", myReader.GetString(2)))
		End While
	Finally
		myReader.Close()
		myConnection.Close()
	End Try
End Sub
Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Data.Common.DbConnection
            Devart.Common.DbConnectionBase
               Devart.Data.SqlShimConnection

See Also