dotConnect for FreshBooks Documentation
Devart.Data.FreshBooks Namespace / FreshBooksConnection Class / CreateCommand Method
Example

CreateCommand Method (FreshBooksConnection)
Creates and returns a FreshBooksCommand object associated with the FreshBooksConnection.
Creates and returns a FreshBooksCommand object associated with the FreshBooksConnection.
Syntax
'Declaration
 
Public Shadows Function CreateCommand() As FreshBooksCommand
 

Return Value

Remarks
You can use this method as an alternative to common FreshBooksCommand constructors.
Example
In this sample FreshBooksCommand object is created. It is automatically associated with FreshBooksConnection that created it.
public void CreateFreshBooksCommand(string myConnString)
{
  FreshBooksConnection freshbooksConnection = new FreshBooksConnection(myConnString);
  FreshBooksCommand freshbooksCommand = freshbooksConnection.CreateCommand();
  freshbooksCommand.CommandText = "INSERT INTO Client (Email, FirstName, LastName) VALUES ('smithj@test1.com', 'John', 'Smith')";
  freshbooksConnection.Open();
  try
  {
    freshbooksCommand.ExecuteNonQuery();
  }
  finally
  {
    freshbooksConnection.Close();
  }
}
Public Sub CreateFreshBooksCommand(ByVal myConnString As String)
  Dim freshbooksConnection As New FreshBooksConnection(myConnString)
  Dim freshbooksCommand As FreshBooksCommand = freshbooksConnection.CreateCommand()
  freshbooksCommand.CommandText = "INSERT INTO Client (Email, FirstName, LastName) VALUES ('smithj@test1.com', 'John', 'Smith')"
  freshbooksConnection.Open()
  Try
    freshbooksCommand.ExecuteNonQuery()
  Finally
    freshbooksConnection.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