// 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.Data; using System.Data.SQLite; public class Test { public static void Main(string[] args) { using(SQLiteConnection con = new SQLiteConnection("Data Source=test.db")) { con.Open(); using(SQLiteCommand ins = new SQLiteCommand("INSERT INTO multi(msg) VALUES(@msg)", con)) { ins.Parameters.Add("@msg", DbType.String, 50); ins.Parameters["@msg"].Value = "Hi from C# on Windows"; ins.ExecuteNonQuery(); } using(SQLiteCommand sel = new SQLiteCommand("SELECT id,msg FROM multi", con)) { using(SQLiteDataReader rdr = sel.ExecuteReader()) { while(rdr.Read()) { Console.WriteLine("{0} {1}", rdr["id"], rdr["msg"]); } } } } } }