CreateCommand Method (PgSqlConnection)
Creates and returns a
PgSqlCommand object associated with the
PgSqlConnection.
In this sample
PgSqlCommand object is created. It is automatically associated with
PgSqlConnection that created it.
|
|---|
public void CreatePgSqlCommand(string myConnString)
{
PgSqlConnection pgSqlConnection = new PgSqlConnection(myConnString);
PgSqlCommand pgSqlCommand = pgSqlConnection.CreateCommand();
pgSqlCommand.CommandText = "INSERT INTO DEPT VALUES (50,'Development','Philadelphia')";
pgSqlConnection.Open();
try
{
pgSqlCommand.ExecuteNonQuery();
}
finally
{
pgSqlConnection.Close();
}
} |
|
|---|
Public Sub CreatePgSqlCommand(ByVal myConnString As String)
Dim pgSqlConnection As New PgSqlConnection(myConnString)
Dim pgSqlCommand As PgSqlCommand = pgSqlConnection.CreateCommand()
pgSqlCommand.CommandText = "INSERT INTO DEPT VALUES (50,'Development','Philadelphia')"
pgSqlConnection.Open()
Try
pgSqlCommand.ExecuteNonQuery()
Finally
pgSqlConnection.Close()
End Try
End Sub |