以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 在保存按钮如何实现在录入或替换窗口时间控间上的时间 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=151746) |
||||
-- 作者:采菊东篱下 -- 发布时间:2020/7/2 16:01:00 -- 在保存按钮如何实现在录入或替换窗口时间控间上的时间
密码:888888 在排座时有时忘了选时间,如果窗口已关闭,控件上原选定的数据全没了,只能重新选定,我想实现重新选定后在保存按钮中保存或修改时间,这段代码比赛积分表上的时间并没有替换。 Dim qsmc As WinForm.ComboBox = e.Form.Controls("棋赛名称") Dim di1 As String = qsmc.Value Dim m As WinForm.TextBox = e.Form.Controls("第几轮") Dim di2 As String = m.Value Dim bsrq As WinForm.DateTimePicker = e.Form.Controls("rq") Dim di3 As Date = bsrq.Value Dim fz As WinForm.ComboBox = e.Form.Controls("fenzhu") Dim Str As String = fz.Value For Each nr As Row In Tables("综合组").Rows Dim dr As DataRow = DataTables("比赛积分").SQLfind("[棋赛名称] = \'" & di1 & "\' And [第几轮比赛] = \'" & di2 & "\' And [分组] = \'" & Str & "\' And [编号] = \'" & nr("红方_编号") & "\'") If di3 = "" Then dr("日期").Cancel = True Else dr("日期") = di3 End If If dr IsNot Nothing Then dr("桌号") = nr("桌号") dr("红黑方") = "红方" dr("积分") = nr("当前局成绩_红方") dr.Save End If dr = DataTables("比赛积分").SQLfind("[棋赛名称] = \'" & di1 & "\' And [第几轮比赛] = \'" & di2 & "\' And [分组] = \'" & Str & "\' And [编号]=\'" & nr("黑方_编号") & "\'") If dr IsNot Nothing Then dr("桌号") = nr("桌号") dr("红黑方") = "黑方" dr("积分") = nr("当前局成绩_黑方") dr.Save End If Next |
||||
-- 作者:有点蓝 -- 发布时间:2020/7/2 16:08:00 -- Dim qsmc As WinForm.ComboBox = e.Form.Controls("棋赛名称") Dim di1 As String = qsmc.Value Dim m As WinForm.TextBox = e.Form.Controls("第几轮") Dim di2 As String = m.Value Dim bsrq As WinForm.DateTimePicker = e.Form.Controls("rq") if bsrq.text ="" then msgbox("请选择日期") return end if Dim di3 As Date = bsrq.Value Dim fz As WinForm.ComboBox = e.Form.Controls("fenzhu") Dim Str As String = fz.Value For Each nr As Row In Tables("综合组").Rows Dim dr As DataRow = DataTables("比赛积分").SQLfind("[棋赛名称] = \'" & di1 & "\' And [第几轮比赛] = \'" & di2 & "\' And [分组] = \'" & Str & "\' And [编号] = \'" & nr("红方_编号") & "\'") dr("日期") = di3
|
||||
-- 作者:采菊东篱下 -- 发布时间:2020/7/2 16:19:00 -- 如果窗口日期控件上没重新选择日择,就执行原来的日期,比赛积分表日期不变,因为比赛积分表日期已录入,关闭窗口后重新打开,只作单纯的录入积分保存,这时比赛积分表的日期可不作改变。 |
||||
-- 作者:有点蓝 -- 发布时间:2020/7/2 16:46:00 -- Dim qsmc As WinForm.ComboBox = e.Form.Controls("棋赛名称") Dim di1 As String = qsmc.Value Dim m As WinForm.TextBox = e.Form.Controls("第几轮") Dim di2 As String = m.Value Dim bsrq As WinForm.DateTimePicker = e.Form.Controls("rq") Dim di3 As Date = bsrq.Value Dim fz As WinForm.ComboBox = e.Form.Controls("fenzhu") Dim Str As String = fz.Value For Each nr As Row In Tables("综合组").Rows Dim dr As DataRow = DataTables("比赛积分").SQLfind("[棋赛名称] = \'" & di1 & "\' And [第几轮比赛] = \'" & di2 & "\' And [分组] = \'" & Str & "\' And [编号] = \'" & nr("红方_编号") & "\'") if di3 <> nothing then dr("日期") = di3 end if |
||||
-- 作者:采菊东篱下 -- 发布时间:2020/7/2 17:50:00 -- if di3 <> nothing then报错,我改为if di3 <> "" then一样报错。 |
||||
-- 作者:有点蓝 -- 发布时间:2020/7/2 20:01:00 -- if di3 <> nothing then绝对不可能有问题,有也是其他地方的问题 |
||||
-- 作者:采菊东篱下 -- 发布时间:2020/7/2 20:01:00 -- 报错
密码:888888 此主题相关图片如下:33.png Dim qsmc As WinForm.ComboBox = e.Form.Controls("棋赛名称") Dim di1 As String = qsmc.Value Dim m As WinForm.TextBox = e.Form.Controls("第几轮") Dim di2 As String = m.Value Dim bsrq As WinForm.DateTimePicker = e.Form.Controls("rq") Dim di3 As Date = bsrq.Value Dim fz As WinForm.ComboBox = e.Form.Controls("fenzhu") Dim Str As String = fz.Value For Each nr As Row In Tables("综合组").Rows Dim dr As DataRow = DataTables("比赛积分").SQLfind("[棋赛名称] = \'" & di1 & "\' And [第几轮比赛] = \'" & di2 & "\' And [分组] = \'" & Str & "\' And [编号] = \'" & nr("红方_编号") & "\'") If di3 <> Nothing Then dr("日期") = di3 End If dr("桌号") = nr("桌号") dr("红黑方") = "红方" dr("积分") = nr("当前局成绩_红方") dr.Save dr = DataTables("比赛积分").SQLfind("[棋赛名称] = \'" & di1 & "\' And [第几轮比赛] = \'" & di2 & "\' And [分组] = \'" & Str & "\' And [编号]=\'" & nr("黑方_编号") & "\'") dr("桌号") = nr("桌号") dr("红黑方") = "黑方" dr("积分") = nr("当前局成绩_黑方") dr.Save Next DataTables("比赛积分").load |
||||
-- 作者:有点蓝 -- 发布时间:2020/7/2 20:04:00 -- 没有判断SQLfind返回的结果是否有值 |
||||
-- 作者:采菊东篱下 -- 发布时间:2020/7/2 20:05:00 --
[此贴子已经被作者于2020/7/2 20:06:18编辑过]
|
||||
-- 作者:采菊东篱下 -- 发布时间:2020/7/2 20:17:00 -- 没有判断SQLfind返回的结果是否有值 保存按钮执行的是把在对阵表中输入的积分保存到比赛积分表,比赛积分表的数据通过排座按钮已生成数据,对阵表引用比赛积分表数据安指定格式显示而已,对阵表有数据显示,比赛积分表就一定有值,我故意把判断删除的。
|