dotConnect for SQLite Documentation
Devart.Data.SQLite Namespace / SQLiteCommand Class / ExecuteReader Method / ExecuteReader(CommandBehavior) Method
One of the System.Data.CommandBehavior values.
Example

On this page
    ExecuteReader(CommandBehavior) Method
    On this page
    Sends the CommandText to the Connection, and builds a SQLiteDataReader using one of the System.Data.CommandBehavior values.
    Syntax
    'Declaration
     
    Public Overloads Shadows Function ExecuteReader( _
       ByVal behavior As CommandBehavior _
    ) As SQLiteDataReader
    public new SQLiteDataReader ExecuteReader( 
       CommandBehavior behavior
    )

    Parameters

    behavior
    One of the System.Data.CommandBehavior values.

    Return Value

    Example
    The following example creates a SQLiteCommand, then executes it by passing a string that is SQL SELECT statement, and a string to use to connect to the data source. The System.Data.CommandBehavior is then set to CloseConnection.
    public void CreateSQLiteDataReader(string mySelectQuery,string sqLiteConnectionString)
    {
      SQLiteConnection sqLiteConnection = new SQLiteConnection(sqLiteConnectionString);
      SQLiteCommand sqLiteCommand = new SQLiteCommand(mySelectQuery, sqLiteConnection);
      sqLiteCommand.Connection.Open();
      SQLiteDataReader sqLiteReader = sqLiteCommand.ExecuteReader(CommandBehavior.CloseConnection);
      while(sqLiteReader.Read())
      {
        Console.WriteLine(sqLiteReader.GetString(0));
      }
      sqLiteReader.Close();
    }
    Public Sub CreateSQLiteDataReader(mySelectQuery As String, _
    sqLiteConnectionString As String)
      Dim sqLiteConnection As New SQLiteConnection(sqLiteConnectionString)
      Dim sqLiteCommand As New SQLiteCommand(mySelectQuery, sqLiteConnection)
      sqLiteCommand.Connection.Open()
      Dim sqLiteReader As SQLiteDataReader = sqLiteCommand.ExecuteReader(CommandBehavior.CloseConnection)
      While sqLiteReader.Read()
        Console.WriteLine(sqLiteReader.GetString(0))
      End While
      sqLiteReader.Close()
    End Sub
    See Also