/// <summary>
/// 查询
/// </summary>
/// <returns></returns>
public IQueryable<tlog> selecttlog() {
atomDataContext atomresult = new atomDataContext();
var tg = from a in atomresult.tlog select a;
return tg;
}
/// <summary>
/// 修改
/// </summary>
/// <param name="id"></param>
/// <param name="logtime"></param>
/// <param name="uid"></param>
/// <param name="uname"></param>
/// <param name="logcontent"></param>
/// <param name="logip"></param>
/// <returns></returns>
public bool upadatelog(int id, DateTime logtime, int uid, string uname, string logcontent, string logip) {
atomDataContext atomresult = new atomDataContext();
tlog tg =atomresult.tlog.Single(a=>a.logid==id);
tg.logtime = logtime;
tg.uid = uid;
tg.uname = uname;
tg.loginfo = logcontent;
tg.logip = logip;
atomresult.SubmitChanges();
return true;
}
/// <summary>
/// 添加
/// </summary>
/// <param name="logtime"></param>
/// <param name="uid"></param>
/// <param name="uname"></param>
/// <param name="logcontent"></param>
/// <param name="logip"></param>
/// <returns></returns>
public bool insertlog(DateTime logtime, int uid, string uname, string logcontent, string logip) {
atomDataContext atomresult = new atomDataContext();
tlog tg = new tlog();
tg.logtime = logtime;
tg.uid = uid;
tg.uname = uname;
tg.loginfo = logcontent;
tg.logip = logip;
atomresult.SubmitChanges();
return true;
}
/// <summary>
/// 删除
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public bool deletelog(int id) {
atomDataContext atomresult = new atomDataContext();
tlog tg = atomresult.tlog.Single(a => a.logid == id);
atomresult.tlog.DeleteOnSubmit(tg);
atomresult.SubmitChanges();
return true;
}
asp.net 使用linq to sql 曾删改查
最新推荐文章于 2024-09-05 12:12:30 发布