以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 使用 ExecuteReader(True) 导致数据丢失 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=159191) |
-- 作者:bahamute -- 发布时间:2020/12/16 14:22:00 -- 使用 ExecuteReader(True) 导致数据丢失 以下代码一运行,就会导致数据库中表A数据被全部清空,不知何故? Dim t As Table \'t为窗口查询表 t=e.Form.Controls("Table1").Table Dim cmd
As new
SQLCommandcmd.ConnectionName = "aaa" Dim dt As DataTable cmd.CommandText = "S e l e c t * From {表A} Where [_Identify] Is not null" \'生成表 dt = c m d.ExecuteReader(True) \'记得将参数设置为True For Each dr As DataRow in dt.DataRows dr("标识") = True Next dt.Save t.DataSource =dt
[此贴子已经被作者于2020/12/16 14:23:00编辑过]
|
-- 作者:有点蓝 -- 发布时间:2020/12/16 14:33:00 -- 试试,如果还有问题,肯定不是这里代码的原因,检查其它代码 Dim t As Table \'t为窗口查询表 t=e.Form.Controls("Table1").Table Dim cmd As new SQLCommandcmd.ConnectionName = "aaa" Dim dt As DataTable cmd.CommandText = "S e l e c t * From {表A} Where [_Identify] Is not null" \'生成表 dt = c m d.ExecuteReader(True) \'记得将参数设置为True t.DataSource =dt For Each dr As Row in t.Rows dr("标识") = True Next t.Save |