Exemplo n.º 1
0
        private DBHandler()
        {
            this.connection = new SQLiteConnection();
            string datasource = ConfigurationManager.AppSettings["DataSource"].ToString();
            SQLiteConnectionStringBuilder connstr = new SQLiteConnectionStringBuilder();
            connstr.DataSource = datasource;
            this.connection.ConnectionString = connstr.ToString();
            this.connection.Open();

            this.dataContext = new StudentDataContext(this.connection);
        }
Exemplo n.º 2
0
        public void TestInsert()
        {
            Student stu1 = new Student() { Name = "stu''1", Identity = "2202014986146513541", Contact = "1212", StartTime = DateTime.Parse("2012-1-1"), EndTime = DateTime.Parse("2012-2-1") };
            Student stu2 = new Student() { Name = "stu2", Identity = "2202014981212113541", Contact = "1212", StartTime = DateTime.Parse("2012-1-1") };
            StudentCollection _allStudents = new StudentCollection();

            StudentDataContext dc = new StudentDataContext(this.connection);
            dc.StudentTable.InsertOnSubmit(stu2);

            dc.SubmitChanges();
        }