using System;
using System.Data.SQLite;
namespace ReadSQL
{
class Program
{
static void Main(string[] args)
{
SQLiteConnection conexion = new SQLiteConnection
("Data Source=ejemplo01.sqlite;" +
" Version=3; New=False; Compress=True;");
conexion.Open();
string consulta = "select * from books";
SQLiteCommand cmd = new SQLiteCommand(consulta, conexion);
SQLiteDataReader datos = cmd.ExecuteReader();
while (datos.Read())
{
string name = Convert.ToString(datos[0]);
string autor = Convert.ToString(datos[1]);
string genre = Convert.ToString(datos[2]);
string summary = Convert.ToString(datos[3]);
System.Console.WriteLine("Name: {0}," +
" Autor: {1}, Genre: {2}, Summary: {3}",
name, autor, genre, summary);
}
conexion.Close();
}
}
}