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
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