CreateCommand Method (DynamicsConnection)
Creates and returns a
DynamicsCommand object associated with the
DynamicsConnection.
In this sample
DynamicsCommand object is created. It is automatically associated with
DynamicsConnection that created it.
public void CreateDynamicsCommand(string myConnString)
{
DynamicsConnection dynamicsConnection = new DynamicsConnection(myConnString);
DynamicsCommand dynamicsCommand = dynamicsConnection.CreateCommand();
dynamicsCommand.CommandText = "INSERT INTO Contact (FirstName,LastName) VALUES ('John','Smith')";
dynamicsConnection.Open();
try
{
dynamicsCommand.ExecuteNonQuery();
}
finally
{
dynamicsConnection.Close();
}
}
Public Sub CreateDynamicsCommand(ByVal myConnString As String)
Dim dynamicsConnection As New DynamicsConnection(myConnString)
Dim dynamicsCommand As DynamicsCommand = dynamicsConnection.CreateCommand()
dynamicsCommand.CommandText = "INSERT INTO Contact (FirstName,LastName) VALUES ('John','Smith')"
dynamicsConnection.Open()
Try
dynamicsCommand.ExecuteNonQuery()
Finally
dynamicsConnection.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