Example #1
0
        public void InsertDao()
        {
            object objOpt   = System.Reflection.Missing.Value;
            var    dbEngine = new DAO.DBEngine();

            DAO.Database  cdb = dbEngine.OpenDatabase(@"c:\Projects\ะก\Databases\Databases\dbproba.mdb", objOpt, false, objOpt);
            DAO.Recordset rec = cdb.OpenRecordset("Tabl1", DAO.RecordsetTypeEnum.dbOpenDynaset, DAO.RecordsetOptionEnum.dbSeeChanges, DAO.LockTypeEnum.dbOptimistic);
            rec.MoveFirst();
            MessageBox.Show(rec.Fields["s1"].Value.ToString());
            rec.AddNew();
            rec.Fields["s1"].Value = "ssssss";
            rec.Update();
            rec.Close();
            cdb.Close();
        }
Example #2
0
        public void MegaInsertDao()
        {
            object objOpt   = System.Reflection.Missing.Value;
            var    dbEngine = new DAO.DBEngine();

            DAO.Database  cdb = dbEngine.OpenDatabase(@"dbproba.mdb", objOpt, false, objOpt);
            DAO.Recordset rec = cdb.OpenRecordset("Tabl3", DAO.RecordsetTypeEnum.dbOpenDynaset, DAO.RecordsetOptionEnum.dbSeeChanges, DAO.LockTypeEnum.dbOptimistic);
            DateTime      d   = DateTime.Now;

            for (int i = 1; i <= 10000; ++i)
            {
                rec.AddNew();
                rec.Fields["s1"].Value = i.ToString();
                rec.Fields["s2"].Value = "n";
                rec.Update();
            }
            rec.Close();
            cdb.Close();
            MessageBox.Show(DateTime.Now.Subtract(d).ToString());
        }