需要增加一个判断 如果你 终端用户 表么 选择列 没有任何勾选 提示勾选 有的话执行下面的代码
Dim Result As DialogResult
Result = MessageBox.Show("确认返回订单部吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.Yes Then
Dim fdr As DataRow = DataTables("终端用户").find("用户ID = '" & Tables("订单总表").current("用户ID") & "'")
If fdr Is Nothing Then
Dim dt1 As DataTable = DataTables("订单总表") '指定数据来源
Dim dt2 As DataTable = DataTables("终端用户")
Dim drs As List(Of DataRow) = dt1.Select("选择 = true")
If drs.Count > 0 Then
Dim dr As DataRow = dt2.AddNew
dr("用户ID") = drs(0)("用户ID")
dr("用户姓名") = drs(0)("用户姓名")
dr("楼盘") = drs(0)("楼盘")
dr("单元房号") = drs(0)("单元房号")
systemready = False
For i As Integer = 1 To drs.Count - 1
Dim ndr As DataRow = dt2.AddNew
ndr("用户ID") = drs(i)("用户ID")
ndr("用户姓名") = drs(i)("用户姓名")
ndr("楼盘") = drs(i)("楼盘")
ndr("楼盘") = drs(i)("楼盘")
ndr("单元房号") = drs(i)("单元房号")
ndr("建档日期") = dr("建档日期")
ndr("订单号") = dr("订单号")
Next
systemready = True
DataTables("订单总表").DeleteFor("选择 = true")
End If
msgbox("撤销订单成功")
Else
msgbox("订单已存在")
End If
End If