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