StringBuilder msg = new StringBuilder();新增
using (Entities db = new Entities())
{
var q = (from c in db.SYS_EIPLOG
orderby c.LOG_DATE descending
select c);
foreach (var s in q)
{
msg.AppendFormat("{0}\r\n", s.LOG_ACTION);
}
}
label1.Text = msg.ToString();
using (Entities db = new Entities())修改
{
IPAddress sip = new IPAddress(Dns.GetHostByName(Dns.GetHostName()).AddressList[0].Address);
SYS_EIPLOG slog = new SYS_EIPLOG();
slog.REC_NO = (from c in db.SYS_EIPLOG select c).Count() + 1;
slog.LOG_DATE = System.DateTime.Now;
slog.LOG_USER = "K0675";
slog.LOG_IP = sip.ToString();
slog.LOG_MOD = "linq";
slog.LOG_ACTION = "TEST";
slog.LOG_VALUE = "";
db.SYS_EIPLOG.AddObject(slog);
db.SaveChanges();
}
using (Entities db = new Entities())刪除
{
var q = (from c in db.SYS_EIPLOG
where c.REC_NO == 0
select c).First();
q.LOG_VALUE = "2";
db.SaveChanges();
}
using (Entities db = new Entities())
{
var q = (from c in db.SYS_EIPLOG
where c.REC_NO == 0
select c).First();
db.SYS_EIPLOG.DeleteObject(q);
db.SaveChanges();
}
--
看到、想到、說到、做到
能夠填平大海的誓言,也比不上邁出一步的價值
是以吾輩此生,再無任何誓言
沒有留言:
張貼留言