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

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

    Parameters

    commandText
    The text of the query.
    connection
    A PgSqlConnection object that represents the connection to PostgreSQL.
    Remarks
    The following table shows initial property values for an instance of PgSqlCommand.
    Properties Initial value
    CommandText commandText
    CommandTimeout 30
    CommandType System.Data.CommandType.Text
    Connection connection
    Example
    The following example creates a PgSqlCommand and sets some of its properties.
    public void CreateCommand()
    {
      PgSqlConnection pgConnection = new PgSqlConnection(
          "host=server;database=test;user id=postgres;");
      string mySelectQuery = "SELECT * FROM Test.Dept";
      PgSqlCommand pgCommand = new PgSqlCommand(mySelectQuery, pgConnection);
      pgCommand.FetchSize = 100;
    }
    Public Sub CreateCommand()
      Dim pgConnection As New PgSqlConnection( _
        "host=server;database=test;user id=postgres;")
      Dim mySelectQuery As String = _
        "SELECT * FROM Test.Dept"
      Dim pgCommand As New PgSqlCommand(mySelectQuery, pgConnection)
      pgCommand.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