linq to sql 增,删,改示范代码

一,增加

static public bool msg_snd_from_tool(string phone, string text)
{
MSG_TOOLDataContext dc = new MSG_TOOLDataContext();
MSG msg = new MSG();
msg.F_phone = phone;
msg.F_content = text;
msg.F_date = DateTime.Now.ToString();

dc.MSG.InsertOnSubmit(msg);
try
{
dc.SubmitChanges();
}
catch (Exception e1)
{
return false;
}
return true;
}

posted @ 2016-07-26 18:42  shanwater  阅读(198)  评论(0编辑  收藏  举报