dotConnect for SQLite Documentation
Devart.Data.SQLite Namespace / SQLiteConnection Class / CreateCommand Method
Example

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

    Return Value

    A SQLiteCommand object.
    Remarks
    You can use this method as an alternative to common SQLiteCommand constructors.
    Example
    In this sample SQLiteCommand object is created. It is automatically associated with SQLiteConnection that created it.
    public void CreateSQLiteCommand(string myConnString)
    {
      SQLiteConnection sqConnection = new SQLiteConnection(myConnString);
      SQLiteCommand sqCommand = sqConnection.CreateCommand();
      sqCommand.CommandText = "INSERT INTO DEPT VALUES (50,'Development','Philadelphia')";
      sqConnection.Open();
      try
      {
        sqCommand.ExecuteNonQuery();
      }
      finally
      {
        sqConnection.Close();
      }
    }
    Public Sub CreateSQLiteCommand(ByVal myConnString As String)
      Dim sqConnection As New SQLiteConnection(myConnString)
      Dim sqCommand As SQLiteCommand = sqConnection.CreateCommand()
      sqCommand.CommandText = "INSERT INTO DEPT VALUES (50,'Development','Philadelphia')"
      sqConnection.Open()
      Try
        sqCommand.ExecuteNonQuery()
      Finally
        sqConnection.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