linq to sql 怎么插入新记录
usingSystem.Linq;usingSystem.Data.Linq;GuestBookDataContextctx=newGuestBookDataContex...
using System.Linq;
using System.Data.Linq;
GuestBookDataContext ctx = new GuestBookDataContext("连接字符串");
tbGuestBook gb = new tbGuestBook();
gb.ID = Guid.NewGuid();
gb.UserName = tb_UserName.Text;
gb.Message = tb_Message.Text;
gb.IsReplied = false;
gb.PostTime = DateTime.Now;
ctx.tbGuestBook.InsertOnSubmit(gb);
ctx.SubmitChanges();
运行之后没反映,也不出错,我是vs2010,刚接触linq,请高手指教 展开
using System.Data.Linq;
GuestBookDataContext ctx = new GuestBookDataContext("连接字符串");
tbGuestBook gb = new tbGuestBook();
gb.ID = Guid.NewGuid();
gb.UserName = tb_UserName.Text;
gb.Message = tb_Message.Text;
gb.IsReplied = false;
gb.PostTime = DateTime.Now;
ctx.tbGuestBook.InsertOnSubmit(gb);
ctx.SubmitChanges();
运行之后没反映,也不出错,我是vs2010,刚接触linq,请高手指教 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询