Connection Property (PgSqlCommand)
Gets or sets the
PgSqlConnection used by this instance of the
PgSqlCommand.
Property Value
The connection to a data source. The default value is a null reference.
The following example creates a
PgSqlCommand and sets some of its properties.
public void CreateCommand()
{
string mySelectQuery = "SELECT * FROM Test.Dept ORDER BY DeptNo";
PgSqlCommand pgCommand = new PgSqlCommand(mySelectQuery);
pgCommand.Connection = new PgSqlConnection(
"host=server;database=test;user id=postgres;");
pgCommand.CommandType = System.Data.CommandType.Text;
}
Public Sub CreateCommand()
Dim mySelectQuery As String = _
"SELECT * FROM Test.Dept ORDER BY DeptNo"
Dim pgCommand As New PgSqlCommand(mySelectQuery)
pgCommand.Connection = New PgSqlConnection( _
"host=server;database=test;user id=postgres;")
pgCommand.CommandType = System.Data.CommandType.Text
End Sub