dotConnect for SQLite Documentation
ExecuteReader() Method
See Also  Example Send comments on this topic.
Devart.Data.SQLite Namespace > SQLiteCommand Class > ExecuteReader Method : ExecuteReader() Method

Sends the CommandText to the Connection and builds a SQLiteDataReader.

Syntax

Visual Basic (Declaration) 
Public Overloads Shadows Function ExecuteReader() As SQLiteDataReader
C# 
public new SQLiteDataReader ExecuteReader()

Return Value

A SQLiteDataReader object.

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.
C#csharpCopy Code
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();
  try
  {
    while(sqReader.Read())
    {
      Console.WriteLine(sqReader.GetString(0));
    }
  }
  finally
  {
    sqReader.Close();
    sqConnection.Close();
  }
}
C#Visual BasicCopy Code
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()
  Try
    While sqReader.Read()
      Console.WriteLine(sqReader.GetString(0))
    End While
  Finally
    sqReader.Close()
    sqConnection.Close()
  End Try
End Sub

Requirements

Platforms:Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8, Windows 10, Windows Server 2012 family.

See Also