// 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.SqlServerCe; namespace E { public class TestClass { public static void Main(string[] args) { SqlCeEngine eng = new SqlCeEngine("Data Source=TestEmb.sdf; Password=hemmeligt"); eng.CreateDatabase(); SqlCeConnection con = new SqlCeConnection("Data Source=TestEmb.sdf; Password=hemmeligt"); con.Open(); SqlCeCommand cre = new SqlCeCommand("CREATE TABLE tbl (id INTEGER NOT NULL, txt NVARCHAR(50), PRIMARY KEY(id))", con); cre.ExecuteNonQuery(); for(int i = 0; i < 3; i++) { SqlCeCommand ins = new SqlCeCommand("INSERT INTO tbl VALUES(" + i + ",'Test" + i + "')", con); ins.ExecuteNonQuery(); } con.Close(); } } }