dotConnect for Zoho CRM Documentation
Devart.Data.Zoho Namespace / ZohoConnection Class / CreateCommand Method
Example

In This Topic
    CreateCommand Method (ZohoConnection)
    In This Topic
    Creates and returns a ZohoCommand object associated with the ZohoConnection.
    Creates and returns a ZohoCommand object associated with the ZohoConnection.
    Syntax
    'Declaration
     
    Public Shadows Function CreateCommand() As ZohoCommand
    public new ZohoCommand CreateCommand()

    Return Value

    A ZohoCommand object.
    Remarks
    You can use this method as an alternative to common ZohoCommand constructors.
    Example
    In this sample ZohoCommand object is created. It is automatically associated with ZohoConnection that created it.
    public void CreateZohoCommand(string myConnString)
    {
      ZohoConnection zohoConnection = new ZohoConnection(myConnString);
      ZohoCommand zohoCommand = zohoConnection.CreateCommand();
      zohoCommand.CommandText = "INSERT INTO Accounts (\"Account Name\", Phone) VALUES ('Test','555-555-555')";
      zohoConnection.Open();
      try
      {
        zohoCommand.ExecuteNonQuery();
      }
      finally
      {
        zohoConnection.Close();
      }
    }
    Public Sub CreateZohoCommand(ByVal myConnString As String)
      Dim zohoConnection As New ZohoConnection(myConnString)
      Dim zohoCommand As ZohoCommand = zohoConnection.CreateCommand()
      zohoCommand.CommandText = "INSERT INTO Accounts (\"Account Name\", Phone) VALUES ('Test','555-555-555')"
      zohoConnection.Open()
      Try
        zohoCommand.ExecuteNonQuery()
      Finally
        zohoConnection.Close()
      End Try
    End Sub
    Requirements

    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

    See Also