以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 如何实现判断空表执行? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=169761) |
-- 作者:lgz518 -- 发布时间:2021/6/29 14:35:00 -- 如何实现判断空表执行? 如何实现判断空表执行? 需求: 如果"表B"为空,"表A"的数据复制到"表B" 如果"表B"不为空,而且,审核为空,提示请审核 如果"表B"不为空,而且,审核不为空,"表B"的数据复制"表C",完成时,提示复制完成后,清空"表B" 下面是思路,请老师,帮完善,谢谢, 如果"表B"为空,"表A"的数据复制到"表B" Dim Cols1() As String = {"列一","列二","列三"} Dim Cols2() As String = {"列一","列二","列三"} For Each dr1 As DataRow In DataTables("表A").Select("[审核] = \'已审核\'") Dim dr2 As DataRow = DataTables("表B").AddNew() For i As Integer = 0 To Cols1.Length -1 dr2(Cols2(i)) = dr1(Cols1(i)) Next Next 如果"表B"不为空,而且,审核为空,提示请审核 MessageBox.Show("请审核!") 如果"表B"不为空,而且,审核不为空,"表B"的数据复制"表C",完成时,提示复制完成后,清空"表B" Dim Cols1() As String = {"列一","列二","列三"} Dim Cols2() As String = {"列一","列二","列三"} For Each dr1 As DataRow In DataTables("表B").Select("[审核] = \'已审核\'") Dim dr2 As DataRow = DataTables("表C").AddNew() For i As Integer = 0 To Cols1.Length -1 dr2(Cols2(i)) = dr1(Cols1(i)) Next Next MessageBox.Show("复制完成!") DataTables("表B").RemoveFor("") |
-- 作者:有点蓝 -- 发布时间:2021/6/29 14:39:00 -- 行数为0就是空表:http://www.foxtable.com/webhelp/topics/0419.htm if DataTables("表B").DataRows.Count = 0 then msgbox("空表") end if
|
-- 作者:有点蓝 -- 发布时间:2021/6/29 14:40:00 -- 审核为空是是哪一行审核为空?还是所有行审核都为空 |
-- 作者:lgz518 -- 发布时间:2021/6/29 14:46:00 -- 审核列发现任意一行,为空或不为空,所有的 |
-- 作者:lgz518 -- 发布时间:2021/6/29 14:47:00 -- 是要写窗口上,“检测”按键的单击,去实现上面需求 |
-- 作者:有点蓝 -- 发布时间:2021/6/29 15:03:00 -- 为空条件 For Each dr1 As DataRow In DataTables("表B").Select("[审核] is null") 不为空条件 For Each dr1 As DataRow In DataTables("表B").Select("[审核] is not null")
|
-- 作者:lgz518 -- 发布时间:2021/6/29 15:56:00 -- 需求: 如果"表B"为空,"表A"的数据复制到"表B" 如果"表B"不为空,而且,审核为空,提示请审核 如果"表B"不为空,而且,审核不为空,"表B"的数据复制"表C",完成时,提示复制完成后,清空"表B" 如果"表B"为空,"表A"的数据复制到"表B", If DataTables("表B").DataRows.Count = 0 Then Dim Cols1() As String = {"列一","列二","列三"} Dim Cols2() As String = {"列一","列二","列三"} For Each dr1 As DataRow In DataTables("表A").Select("[审核] = \'已审核\'") Dim dr2 As DataRow = DataTables("表B").AddNew() For i As Integer = 0 To Cols1.Length -1 dr2(Cols2(i)) = dr1(Cols1(i)) Next Next 如果"表B"不为空,而且,审核为空,提示请审核 ElseIf DataTables("表B").DataRows(0).IsNull("审核") Then MessageBox.Show("请审核!") 如果"表B"不为空,而且,审核不为空,"表B"的数据复制"表C",完成时,提示复制完成后,清空"表B" ElseIf DataTables("表B").DataRows(0).IsNull("审核"不为空) Then Dim Cols1() As String = {"列一","列二","列三"} Dim Cols2() As String = {"列一","列二","列三"} For Each dr1 As DataRow In DataTables("表B").Select("[审核] = \'已审核\'") Dim dr2 As DataRow = DataTables("表C").AddNew() For i As Integer = 0 To Cols1.Length -1 dr2(Cols2(i)) = dr1(Cols1(i)) Next Next MessageBox.Show("复制完成!") DataTables("表B").RemoveFor("") Else End If 老师,大致代码上面,第一段代码执行是可以,后面审核为空与不为空有问题 |
-- 作者:有点蓝 -- 发布时间:2021/6/29 16:06:00 -- …… 如果"表B"不为空,而且,审核为空,提示请审核 Else If DataTables("表B").find("审核 is null") isnot nothing Then MessageBox.Show("请审核!") 如果"表B"不为空,而且,审核不为空,"表B"的数据复制"表C",完成时,提示复制完成后,清空"表B" Else Dim Cols1() As String = {"列一","列二","列三"} Dim Cols2() As String = {"列一","列二","列三"} ……
|
-- 作者:lgz518 -- 发布时间:2021/6/29 16:17:00 -- 1,如果"表B"不为空,而且,审核不为空,"表B"的数据复制"表C",完成时,提示复制完成后,清空"表B" ElseIf DataTables("表B").DataRows(0).IsNull("审核"不为空) Then,,这个如果"表B"不为空,而且,审核不为空,为会写 |
-- 作者:有点蓝 -- 发布时间:2021/6/29 16:30:00 -- If DataTables("表B").find("审核 is null") isnot nothing Then如果为空 MessageBox.Show("请审核!") 如果"表B"不为空,而且,审核不为空,"表B"的数据复制"表C",完成时,提示复制完成后,清空"表B" Else否则不为空
|