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;
}