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

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

    Parameters

    commandText
    The text of the query.
    connection
    A UniConnection object that represents the connection to an instance of server.
    transaction
    UniTransaction object used to perform transactions with this UniCommand object.
    Remarks
    The following table shows initial property values for an instance of this implementation of the UniCommand.
    Properties Initial value
    CommandText commandText
    System.Data.DbCommand.CommandTimeout 30
    CommandType System.Data.CommandType.Text
    Connection connection

    You can change the value for any of these parameters by setting the related property.

    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");
      myConnection.Open();
      UniTransaction myTrans = myConnection.BeginTransaction();
      string mySelectQuery = "SELECT * FROM Test.Dept";
      UniCommand myCommand = new UniCommand(mySelectQuery, myConnection,myTrans);
      myCommand.FetchSize = 100
    }
    Public Sub CreateCommand()
      Dim myConnection As New UniConnection _
        ("Provider=SQL Server;Data Source=SERVER;Initial Catalog=Northwind;User ID=sa")
      myConnection.Open()
      Dim myTrans As UniTransaction = myConnection.BeginTransaction()
      Dim mySelectQuery As String = _
        "SELECT * FROM Test.Dept"
      Dim myCommand As New UniCommand(mySelectQuery, myConnection, myTrans)
      myCommand.FetchSize = 100
    End Sub
    See Also