dotConnect for PostgreSQL Documentation
Devart.Data.PostgreSql Namespace / PgSqlCommand Class / PgSqlCommand Constructor / PgSqlCommand Constructor(String,PgSqlConnection,PgSqlTransaction)
The text of the query.
A PgSqlConnection object that represents the connection to PostgreSQL.
PgSqlTransaction object used to perform transactions with this PgSqlCommand object.
Example

On this page
    PgSqlCommand Constructor(String,PgSqlConnection,PgSqlTransaction)
    On this page
    Initializes a new instance of the PgSqlCommand class with the text of the query, a PgSqlConnection object, and the PgSqlTransaction.
    Syntax
    'Declaration
     
    Public Function New( _
       ByVal commandText As String, _
       ByVal connection As PgSqlConnection, _
       ByVal transaction As PgSqlTransaction _
    )
    public PgSqlCommand( 
       string commandText,
       PgSqlConnection connection,
       PgSqlTransaction transaction
    )

    Parameters

    commandText
    The text of the query.
    connection
    A PgSqlConnection object that represents the connection to PostgreSQL.
    transaction
    PgSqlTransaction object used to perform transactions with this PgSqlCommand object.
    Remarks
    The following table shows initial property values for an instance of this implementation of the PgSqlCommand.
    Properties Initial value
    CommandText commandText
    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 PgSqlCommand and sets some of its properties.
    public void CreateCommand()
    {
      PgSqlConnection pgSqlConnection = new PgSqlConnection(
          "host=server;database=test;user id=postgres;");
      pgSqlConnection.Open();
      PgSqlTransaction myTrans = pgSqlConnection.BeginTransaction();
      string mySelectQuery = "SELECT * FROM Test.Dept";
      PgSqlCommand pgSqlCommand = new PgSqlCommand(mySelectQuery, pgSqlConnection,myTrans);
      pgSqlCommand.FetchSize = 100
    }
    Public Sub CreateCommand()
      Dim pgSqlConnection As New PgSqlConnection( _
        "host=server;database=test;user id=postgres;")
      pgSqlConnection.Open()
      Dim myTrans As PgSqlTransaction = pgSqlConnection.BeginTransaction()
      Dim mySelectQuery As String = _
        "SELECT * FROM Test.Dept"
      Dim pgSqlCommand As New PgSqlCommand(mySelectQuery, pgSqlConnection, myTrans)
      pgSqlCommand.FetchSize = 100
    End Sub
    See Also