Esempio n. 1
0
        public static void updateAndAddTransaction()
        {
            IDbAccess db = IDbFactory.CreateIDb(connStr, dbType);

            try
            {
                db.IsTran = true;
                db.BeginTransaction();
                //add
                string    tableName = "templjqfortest";
                Hashtable ht        = new Hashtable();
                ht.Add("name", "hello db11");
                ht.Add("createtime", new DateTime(2011, 2, 1, 2, 2, 2, 11));
                ht.Add("supertiem", null);

                Console.WriteLine("" + db.AddData(tableName, ht));
                //delete
                string filterStr = "and name >='hello db7'";
                Console.WriteLine("delete is " + db.DeleteRow(tableName, filterStr));
                db.Commit();
            }
            catch (Exception e)
            {
                db.Rollback();
                db.Close();
            }
        }
Esempio n. 2
0
        public static void TestAddData()
        {
            string    connStr   = "Data Source=kfhzbdc200;User ID=sjgj;Password=sjgj";
            IDbAccess db        = IDbFactory.CreateIDb(connStr, "oracle");
            string    tableName = "templjqfortest";
            Hashtable ht        = new Hashtable();

            ht.Add("name", "hello db2");
            ht.Add("createtime", new DateTime(2011, 2, 1, 2, 2, 2, 11));
            ht.Add("supertiem", null);

            Console.WriteLine("" + db.AddData(tableName, ht));
        }