Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var emp = ado.Execute("delete from wfcomment where procinstid=479713337");

            var em2p = ado.SingleOrDefault <WfComment>("select * from [WfComment] where [ProcinstID]=@id or [ProcinstID]=@id2", new { id = 606347220, id2 = 479713337 });

            Console.WriteLine("em2p=null:" + em2p == null);


            WfComment comment = new WfComment
            {
                foLiO        = Guid.NewGuid().ToString(),
                Comment      = Guid.NewGuid().ToString(),
                Action       = Guid.NewGuid().ToString(),
                ActivityName = Guid.NewGuid().ToString(),
                ApproveTime  = DateTime.Now,
                IsFinal      = 1,
                ReceiveTime  = DateTime.Now.AddHours(-1),
                ProcinstID   = DateTime.Now.ToString().GetHashCode()
            };
            int rs = ado.Insert <WfComment>(comment);

            Console.WriteLine(rs);

            Console.WriteLine("开始插入500次");
            Stopwatch sw = new Stopwatch();

            sw.Start();
            ado.BeginTrans();
            for (int i = 0; i < 500; i++)
            {
                ado.Insert <WfComment>(comment);
            }
            ado.CommitTrans();
        }
Пример #2
0
        private void Delete()
        {
            //string sqlcmdtext = "select * from [Person] where id in (@id1)";
            //var psn = db.SingleOrDefault<Person>(sqlcmdtext, new { id1 = 4 });
            //if (psn == null) Response.Write(" psn is null ");
            //else
            //{
            //    int i = db.Delete<Person>(psn);
            //    Response.Write("Affect rows:" + i + "<br/>");
            //    Response.Write("delete success");
            //}

            string sql = "delete from [person] where id=@id";
            int    rt  = db.Execute(sql, new { id = 3 });

            Response.Write("Delete Rows:" + rt);
        }