// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Collections.Generic; using System.Data.SQLite; namespace DumpADONET { public class T1 { public long F1 { get; set; } public string F2 { get; set; } } public class Program { public static List Get() { List res = new List(); using(SQLiteConnection con = new SQLiteConnection(@"Data Source=C:\Work\test.sqlite")) { con.Open(); using(SQLiteCommand cmd = new SQLiteCommand("SELECT f1,f2 FROM t1", con)) { using(SQLiteDataReader rdr = cmd.ExecuteReader()) { while(rdr.Read()) { res.Add(new T1 { F1 = (long)rdr["f1"], F2 = (string)rdr["f2"] }); } } } } return res; } public static void Main(string[] args) { foreach(T1 o in Get()) { Console.WriteLine("{0} {1}", o.F1, o.F2); } } } }