以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助] DataColChanged事件相关问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=86957) |
-- 作者:lzzhx -- 发布时间:2016/6/29 17:10:00 -- [求助] DataColChanged事件相关问题 Dim cmd As New SQLCommand cmd.ConnectionName= gs_strActiveConn cmd.CommandText= "s elect 窗体ID from {窗口程序说明} where [窗口名称] = \'" & e.Form.name & "\'" Dim dtName As DataTable = cmd.ExecuteReader If dtName.DataRows.Count > 0 Then cmd.CommandText= "s elect * from {窗体控件对应表} where [窗体ID] = " & dtName.DataRows(0)("窗体ID") Else cmd.CommandText= "s elect * from {窗体控件对应表} where 1=2 " End If Dim dt As DataTable = cmd.ExecuteReader(True) MessageBox.Show("dt.count=" & dt.DataRows.Count) If ListAnniu.Count > 0 Then For Each List As object In ListAnniu Dim dr As DataRow = dt.Find("控件名称 = \'" & List.name & "\'") If dr Is Nothing Then dr = dt.AddNew() dr("窗体ID") = dtName.DataRows(0)("窗体ID") dr("控件名称") = List.name dr("权限控制") = False dr("控件ID") = dr("_Identify") End If dr("控件标题") = List.Text dr("控件类型") = "按钮" \'dr("权限控制") = False dr("删除") = False dr("修改时间") = system_Mydate \' dr("权限类型") = ??? Next End If 红色代码赋值后为 0
|
-- 作者:大红袍 -- 发布时间:2016/6/29 17:29:00 -- 试试
dr.Save dr("控件ID") = dr("_Identify") |
-- 作者:lzzhx -- 发布时间:2016/6/30 7:45:00 -- 大红袍老师:我这样做了后,dr("控件ID") 成了空的 |
-- 作者:Hyphen -- 发布时间:2016/6/30 8:50:00 -- 新增的_Identify 还没有生成 循环完毕后保存表,然后用sql更新 If ListAnniu.Count > 0 Then For Each List As object In ListAnniu Dim dr As DataRow = dt.Find("控件名称 = \'" & List.name & "\'") If dr Is Nothing Then dr = dt.AddNew() dr("窗体ID") = dtName.DataRows(0)("窗体ID") dr("控件名称") = List.name dr("权限控制") = False \'dr("控件ID") = dr("_Identify") End If dr("控件标题") = List.Text dr("控件类型") = "按钮" \'dr("权限控制") = False dr("删除") = False dr("修改时间") = system_Mydate \' dr("权限类型") = ??? Next dt.save cmd.CommandText= "upd ate 窗体控件对应表 set [控件ID]=[_Identify] where [控件ID] is null" cmd.ExecuteNonQuery End If |
-- 作者:lzzhx -- 发布时间:2016/6/30 11:50:00 -- 谢谢老师 |