public void Delete() { //var emp = ado.Execute("delete from wfcomment where procinstid=606347220"); //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)); var emp = ado.SingleOrDefault <WfComment>("select * from [WfComment] where [ProcinstID]=@id or [ProcinstID]=@id2", new { id = -170340317, id2 = -170340317 }); Console.WriteLine(emp.foLiO); ado.Delete(emp); emp = ado.SingleOrDefault <WfComment>("select * from [WfComment] where [ProcinstID]=@id or [ProcinstID]=@id2", new { id = -170340317, id2 = -170340317 }); Console.WriteLine(emp == null); }
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(); }
private void GetOne() { string sqlcmdtext = "select * from [Person] where id in (@id1)";// or id=@id2 //Dictionary<string, object> dic = new Dictionary<string, object>(); //dic.Add("id1", "2"); //dic.Add("id2", "1"); var psnList = db.SingleOrDefault <Person>(sqlcmdtext, new { id1 = 1 }); // Response.Write("psnlist.count=" + psnList.Count() + "<br/>"); //psnList.PersonName = psnList.PersonName + DateTime.Now; Response.Write(psnList.PersonName); //// db.Update<Person>(psnList); //Person ppp = new Person() //{ // Address = "address", // Birthday = DateTime.Now, // Gender = 1, // Gid = Guid.NewGuid(), // Position = "开发", // Salary = 2500, // PersonName = "捏捏" //}; //int rsd = db.Insert<Person>(ppp); //Response.Write(rsd); }