dotConnect for Zoho Desk Documentation
Devart.Data.ZohoDesk Namespace / ZohoDeskConnection Class / CreateCommand Method
Example

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

    Return Value

    A ZohoDeskCommand object.
    Remarks
    You can use this method as an alternative to common ZohoDeskCommand constructors.
    Example
    In this sample ZohoDeskCommand object is created. It is automatically associated with ZohoDeskConnection that created it.
    public void CreateZohoDeskCommand(string myConnString)
    {
      ZohoDeskConnection ZohoDeskConnection = new ZohoDeskConnection(myConnString);
      ZohoDeskCommand ZohoDeskCommand = ZohoDeskConnection.CreateCommand();
      ZohoDeskCommand.CommandText = "INSERT INTO Accounts (\"Account Name\", Phone) VALUES ('Test','555-555-555')";
      ZohoDeskConnection.Open();
      try
      {
        ZohoDeskCommand.ExecuteNonQuery();
      }
      finally
      {
        ZohoDeskConnection.Close();
      }
    }
    Public Sub CreateZohoDeskCommand(ByVal myConnString As String)
      Dim ZohoDeskConnection As New ZohoDeskConnection(myConnString)
      Dim ZohoDeskCommand As ZohoDeskCommand = ZohoDeskConnection.CreateCommand()
      ZohoDeskCommand.CommandText = "INSERT INTO Accounts (\"Account Name\", Phone) VALUES ('Test','555-555-555')"
      ZohoDeskConnection.Open()
      Try
        ZohoDeskCommand.ExecuteNonQuery()
      Finally
        ZohoDeskConnection.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