Beispiel #1
0
        public void CommitDataTranTest()
        {
            using (DbExecutor db = new DbExecutor(new SqlConnection(connString),IsolationLevel.ReadCommitted))
            {
                var dt = db.GetTable(SqlClientFactory.Instance, "select * from MyTest");

                dt.Rows[1]["Name"] = "zhangjuncui";

                DataRow newDr = dt.NewRow();
                dt.Rows.Add(newDr);
                newDr["Name"] = DateTime.Now;
                newDr["Mark"] = "1244";

                db.CommitData(SqlClientFactory.Instance, dt, "MyTest");

                Console.WriteLine("Id:" + newDr["SysId"]);
                db.TransactionComplete();
            }
        }
Beispiel #2
0
        public void CommitDataTest()
        {
            using (DbExecutor db = new DbExecutor(new SqlConnection(connString)))
            {
                var dt = db.GetTable(SqlClientFactory.Instance, "select * from MyTest");

                dt.Rows[0]["Name"] = "zhangjuncui";

                DataRow newDr = dt.NewRow();
                dt.Rows.Add(newDr);
                newDr["Name"] = "ABCD";
                newDr["Mark"] = "1244";

                db.CommitData(SqlClientFactory.Instance, dt, "MyTest");

                Console.WriteLine("Id:"+newDr["SysId"]);
            }
        }