Answers for "SQLite Datareader"

C#
0

SQLite Datareader

using System;
using System.Data.SQLite;

string cs = @"URI=file:C:\Users\Jano\Documents\test.db";

using var con = new SQLiteConnection(cs);
con.Open();

string stm = "SELECT * FROM cars LIMIT 5";

using var cmd = new SQLiteCommand(stm, con);
using SQLiteDataReader rdr = cmd.ExecuteReader();

while (rdr.Read())
{
    Console.WriteLine($"{rdr.GetInt32(0)} {rdr.GetString(1)} {rdr.GetInt32(2)}");
}
Posted by: Guest on October-13-2021

C# Answers by Framework

Browse Popular Code Answers by Language