dotConnect Universal Documentation
Devart.Data.Universal Namespace / UniCommand Class / UniCommand Constructor / UniCommand Constructor(String,UniConnection)
The text of the query.
A UniConnection object that represents the connection to an instance of server.
Example

UniCommand Constructor(String,UniConnection)
Initializes a new instance of the UniCommand class with the text of the query and a %% object.
Syntax
'Declaration
 
Public Function New( _
   ByVal commandText As String, _
   ByVal connection As UniConnection _
)
 

Parameters

commandText
The text of the query.
connection
A UniConnection object that represents the connection to an instance of server.
Remarks
The following table shows initial property values for an instance of UniCommand.
Properties Initial value
CommandText commandText
System.Data.DbCommand.CommandTimeout 30
CommandType System.Data.CommandType.Text
Connection connection
Example
The following example creates a UniCommand and sets some of its properties.
public void CreateCommand()
{
  UniConnection myConnection = new UniConnection("Provider=SQL Server;Data Source=SERVER;Initial Catalog=Northwind;User ID=sa");
  string mySelectQuery = "SELECT * FROM Test.Dept";
  UniCommand myCommand = new UniCommand(mySelectQuery, myConnection);
  myCommand.FetchSize = 100;
}
Public Sub CreateCommand()
  Dim myConnection As New UniConnection _
    ("Provider=SQL Server;Data Source=SERVER;Initial Catalog=Northwind;User ID=sa")
  Dim mySelectQuery As String = _
    "SELECT * FROM Test.Dept"
  Dim myCommand As New UniCommand(mySelectQuery, myConnection)
  myCommand.FetchSize = 100
End Sub
Requirements

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

See Also