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

In This Topic
    ExecuteReader(CommandBehavior) Method
    In This Topic
    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 sqConnectionString)
    {
      SQLiteConnection sqConnection = new SQLiteConnection(sqConnectionString);
      SQLiteCommand sqCommand = new SQLiteCommand(mySelectQuery, sqConnection);
      sqCommand.Connection.Open();
      SQLiteDataReader sqReader = sqCommand.ExecuteReader(CommandBehavior.CloseConnection);
      while(sqReader.Read())
      {
        Console.WriteLine(sqReader.GetString(0));
      }
      sqReader.Close();
    }
    Public Sub CreateSQLiteDataReader(mySelectQuery As String, _
    sqConnectionString As String)
      Dim sqConnection As New SQLiteConnection(sqConnectionString)
      Dim sqCommand As New SQLiteCommand(mySelectQuery, sqConnection)
      sqCommand.Connection.Open()
      Dim sqReader As SQLiteDataReader = sqCommand.ExecuteReader(CommandBehavior.CloseConnection)
      While sqReader.Read()
        Console.WriteLine(sqReader.GetString(0))
      End While
      sqReader.Close()
    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