dotConnect for BigCommerce Documentation
Devart.Data.Bigcommerce Namespace / BigcommerceConnection Class / CreateCommand Method
Example

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

    Return Value

    Remarks
    You can use this method as an alternative to common BigcommerceCommand constructors.
    Example
    In this sample BigcommerceCommand object is created. It is automatically associated with BigcommerceConnection that created it.
    public void CreateBigcommerceCommand(string myConnString)
    {
      BigcommerceConnection bigcommerceConnection = new BigcommerceConnection(myConnString);
      BigcommerceCommand bigcommerceCommand = bigcommerceConnection.CreateCommand();
      bigcommerceCommand.CommandText = "INSERT INTO customers (firstname, lastname, email) VALUES ('John','Smith','[email protected]')";
      bigcommerceConnection.Open();
      try
      {
        bigcommerceCommand.ExecuteNonQuery();
      }
      finally
      {
        bigcommerceConnection.Close();
      }
    }
    Public Sub CreateBigcommerceCommand(ByVal myConnString As String)
      Dim bigcommerceConnection As New BigcommerceConnection(myConnString)
      Dim bigcommerceCommand As BigcommerceCommand = bigcommerceConnection.CreateCommand()
      bigcommerceCommand.CommandText = "INSERT INTO customers (firstname, lastname, email) VALUES ('John','Smith','[email protected]')"
      bigcommerceConnection.Open()
      Try
        bigcommerceCommand.ExecuteNonQuery()
      Finally
        bigcommerceConnection.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