以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 保存时错误 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=185294) |
-- 作者:cd_tdh -- 发布时间:2023/2/15 9:01:00 -- 保存时错误 老师,界面及代码如下,保存时错误,请老师看看哪儿不对 此主题相关图片如下:qq截图20230215085939.jpg |
-- 作者:有点蓝 -- 发布时间:2023/2/15 9:08:00 -- 报什么错? |
-- 作者:cd_tdh -- 发布时间:2023/2/15 9:19:00 -- .NET Framework 版本:4.0.30319.42000 Foxtable 版本:2022.8.18.1 错误所在事件:自定义函数,Rename_checking 详细错误信息: 调用的目标发生了异常。 未将对象引用设置到对象的实例。
|
-- 作者:有点蓝 -- 发布时间:2023/2/15 9:36:00 -- 按示例三改 |
-- 作者:cd_tdh -- 发布时间:2023/2/15 9:54:00 -- 老师,这样不报错了,但是addnew数据没有成功。 ......... Else If e.PostValues.ContainsKey("考勤日期") = False Then \'生成错误提示页 With wb.AddMsgPage("","msgpage","提示", "考勤日期不能为空!") .icon = "Warn" \'改变图标 .AddButton("btn1","返回").Attribute = "" End With e.WriteString(wb.Build) Return Nothing \'必须返回 End If Dim d As Date = e.PostValues("考勤日期") If d > Date.Today Then With wb.AddMsgPage("","msgpage","提示", "未到考勤日期,请勿提前操作!") .icon = "Warn" \'改变图标 .AddButton("btn1","返回").Attribute = "" End With e.WriteString(wb.Build) Return Nothing \'必须返回 End If MessageBox.Show(1) Dim lst As New List(Of String) For Each key As String In e.postvalues.Keys If key Like "考勤人员_*" Then lst.add(e.postvalues(key)) End If Next MessageBox.Show(2) For Each ss As String In DataTables("实名制管理").SQLGetvalues("姓名", "项目名称 = \'" & _UserXmmc & "\' And 在岗状态 = \'在岗\'") Dim dr As DataRow = DataTables("实名制考勤").SQLFind("项目名称 = \'" & _UserXmmc & "\' And 年 = \'" & d.Year & "\' And 月 = \'" & d.Month & "\' And 姓名=\'" & ss & "\'") If dr IsNot Nothing Then Dim dr1 As DataRow = DataTables("实名制考勤").SQLFind("项目名称 = \'" & _UserXmmc & "\' and 年 = \'" & d.Year & "\' and 月 = \'" & d.Month & "\'") If dr1("日" & d.Day) IsNot Nothing Then With wb.AddMsgPage("", "msgpage", "提示", "你选择的日期已经考勤过,请勿重复操作!") .icon = "Warn" \'改变图标 .AddButton("btn1", "返回").Attribute = "" End With e.WriteString(wb.Build) Return Nothing \'必须返回 Else MessageBox.Show(3) dr = DataTables("实名制考勤").AddNew dr("所属机构") = _UserGroup dr("项目名称") = _UserXmmc dr("姓名") = ss dr("年") = d.Year dr("月") = d.Month If lst.contains(ss) dr("日" & d.Day) = "√" Else dr("日" & d.Day) = "×" End If dr.Save End If End If Next MessageBox.Show(4) \'保存并生成增加成功提示页面 With wb.AddMsgPage("","msgpage","考勤成功", "你是否继续考勤?") \'生成成功提示页 .AddButton("btn1","继续考勤","Rename_checking.htm") .AddButton("btn2","首  页","default.htm") End With e.WriteString(wb.Build) End If
|
-- 作者:有点蓝 -- 发布时间:2023/2/15 9:58:00 -- 应该是没有符和条件的数据,自行调试看看各个查询结果 |
-- 作者:cd_tdh -- 发布时间:2023/2/15 11:18:00 -- 还是报一样的错,数据也有,还得请老师看看 Else If e.PostValues.ContainsKey("考勤日期") = False Then \'生成错误提示页 With wb.AddMsgPage("","msgpage","提示", "考勤日期不能为空!") .icon = "Warn" \'改变图标 .AddButton("btn1","返回").Attribute = "" End With e.WriteString(wb.Build) Return Nothing \'必须返回 End If Dim d As Date = e.PostValues("考勤日期") If d > Date.Today Then With wb.AddMsgPage("","msgpage","提示", "未到考勤日期,请勿提前操作!") .icon = "Warn" \'改变图标 .AddButton("btn1","返回").Attribute = "" End With e.WriteString(wb.Build) Return Nothing \'必须返回 End If MessageBox.Show(1) Dim lst As New List(Of String) For Each key As String In e.postvalues.Keys If key Like "考勤人员_*" Then lst.add(e.postvalues(key)) End If Next MessageBox.Show(2) Dim dr As DataRow = DataTables("实名制考勤").SQLFind("项目名称 = \'" & _UserXmmc & "\' and 年 = \'" & d.Year & "\' and 月 = \'" & d.Month & "\'") If dr("日" & d.Day) IsNot Nothing Then With wb.AddMsgPage("", "msgpage", "提示", "你选择的日期已经考勤过,请勿重复操作!") .icon = "Warn" \'改变图标 .AddButton("btn1", "返回").Attribute = "" End With e.WriteString(wb.Build) Return Nothing \'必须返回 Else MessageBox.Show(3) For Each ss As String In DataTables("实名制管理").SQLGetvalues("姓名", "项目名称 = \'" & _UserXmmc & "\' And 在岗状态 = \'在岗\'") Dim dr1 As DataRow = DataTables("实名制考勤").SQLFind("项目名称 = \'" & _UserXmmc & "\' And 年 = \'" & d.Year & "\' And 月 = \'" & d.Month & "\' And 姓名 = \'" & ss & "\'") MessageBox.Show (dr1("姓名")) If dr1 IsNot Nothing Then If lst.contains(ss) Then dr1("日" & d.Day) = "√" Else dr1("日" & d.Day) = "×" End If dr1.Save MessageBox.Show(4) Else dr1 = DataTables("实名制考勤").AddNew() dr1("所属机构") = _UserGroup dr1("项目名称") = _UserXmmc dr1("姓名") = ss dr1("年") = d.Year dr1("月") = d.Month If lst.contains(ss) Then dr1("日" & d.Day) = "√" Else dr1("日" & d.Day) = "×" End If MessageBox.Show(5) dr1.Save End If Next End If
|
-- 作者:有点蓝 -- 发布时间:2023/2/15 11:22:00 -- 同样的问题!!!!!!!!!http://www.foxtable.com/webhelp/topics/2911.htm,看看示例三 |
-- 作者:cd_tdh -- 发布时间:2023/2/15 11:53:00 -- find都有判断IsNot啊 |
-- 作者:有点蓝 -- 发布时间:2023/2/15 11:54:00 -- 这里没有 |