If e.Form.Controls("liuliangkahao").text ="" Then
If MessageBox.Show("流量卡号不能为空,是否继续绑定","提示",MessageBoxButtons.YesNo) =DialogResult.No Then
e.Form.Controls("liuliangkahao").value=Nothing
e.Form.Controls("liuliangkahao").Enabled= False
e.Form.Controls("liuliangkezhuangtaixiugai").Enabled=True
e.Form.Controls("liuliangkejiebang ").Enabled= False
e.Form.Controls("liuliangkabangding").Enabled= False
Return
End If
End If
Dim dr As DataRow = DataTables("流量卡资料").Find("流量卡号='" & e.Form.Controls("liuliangkahao").text & "'")
e.Form.Controls("liuliangkahao").text
If dr Is Nothing Then
msgbox("没有查到符合条件的数据,请核实流量卡是否入库!")
Return
ElseIf dr.IsNull("商户ID") = False Then
msgbox("流量卡已占用,请核实流量卡号!")
Return
End If
If Tables("商户资料表").Current Is Nothing Then Return
If Tables("商户资料表").Current.Isnull("流量卡ID") Then
dr("商户ID") = Tables("商户资料表").Current("商户ID")
dr("商户名称") = Tables("商户资料表").Current("商户名称")
dr("客户ID") = Tables("商户资料表").Current("客户ID")
dr("客户姓名") = Tables("商户资料表").Current("法人姓名")
dr("是否绑定") = True
Tables("商户资料表").Current("流量卡ID")=dr("流量卡ID")
Tables("商户资料表").Current("流量卡号")=dr("流量卡号")
Dim lsjl As Table =Tables("流量卡绑定商户历史记录表")
Dim sr As Row = lsjl .Current
Dim nr As DataRow = lsjl.DataTable.addnew
nr("流量卡ID") =dr("流量卡ID")
nr("流量卡号") =dr("流量卡号")
nr("类型") =dr("类型")
nr("商户ID") =dr("商户ID")
nr("商户名称") =dr("商户名称")
nr("客户ID") =dr("客户ID")
nr("客户姓名") =dr("客户姓名")
nr("绑定日期") =Date.Today
e.Form.Controls("liuliangkahao").text =Nothing
e.Form.Controls("liuliangkahao").Enabled= False
e.Form.Controls("liuliangkezhuangtaixiugai").Enabled=True
e.Form.Controls("liuliangkabangding").Enabled=False
e.Form.Controls("liuliangkejiebang ").Enabled= False
msgbox("该流量卡已成功绑定该商户")
Else
Dim dlg = MessageBox.Show("该商户已经绑定其他流量卡,是否解绑后重新绑定新流量卡,单击是解绑后重新绑定,单击否则添加新商户并绑定到新增的商户,单击取消放弃操作", "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
If dlg = DialogResult.Yes Then
For Each fdr As DataRow In DataTables("流量卡资料").Select("流量卡ID='" & Tables("商户资料表").Current("流量卡ID") & "'")
fdr("商户ID") = Nothing
fdr("商户名称") = Nothing
fdr("客户ID") = Nothing
fdr("客户姓名") = Nothing
fdr("是否绑定") = False
Next
dr("商户ID") = Tables("商户资料表").Current("商户ID")
dr("商户名称") = Tables("商户资料表").Current("商户名称")
dr("客户ID") = Tables("商户资料表").Current("客户ID")
dr("客户姓名") = Tables("商户资料表").Current("法人姓名")
dr("是否绑定") = True
Tables("商户资料表").Current("流量卡ID")=dr("流量卡ID")
Tables("商户资料表").Current("流量卡号")=dr("流量卡号")
Dim lsjl As Table =Tables("流量卡绑定商户历史记录表")
Dim sr As Row = lsjl .Current
Dim nr As DataRow = lsjl.DataTable.addnew
nr("流量卡ID") =dr("流量卡ID")
nr("流量卡号") =dr("流量卡号")
nr("类型") =dr("类型")
nr("商户ID") =dr("商户ID")
nr("商户名称") =dr("商户名称")
nr("客户ID") =dr("客户ID")
nr("客户姓名") =dr("客户姓名")
nr("绑定日期") =Date.Today
Dim lsdr As DataRow = DataTables("流量卡绑定商户历史记录表").Find("流量卡号='" & dr("流量卡号") & "' and 解绑日期 is null")
If lsdr IsNot Nothing Then
nr("解绑日期") =Date.Today
msgbox(lsdr("解绑日期"))
Return
Else
Return
End If
e.Form.Controls("liuliangkahao").text =Nothing
e.Form.Controls("liuliangkahao").Enabled= False
e.Form.Controls("liuliangkezhuangtaixiugai").Enabled=True
e.Form.Controls("liuliangkabangding").Enabled=False
e.Form.Controls("liuliangkejiebang ").Enabled= False
msgbox("该流量卡已成功绑定该商户")
ElseIf dlg = DialogResult.No
'新增加的代码
Dim tbl As Table =Tables("商户资料表")
Dim sr As Row = tbl.Current
Dim nr As DataRow = tbl.DataTable.addnew
nr("通道名称") = sr("通道名称")
nr("网点地址") = sr("网点地址")
nr("商户名称") = sr("商户名称")
nr("网点名称") = sr("网点名称")
nr("网点编号") = sr("网点编号")
nr("备注") = sr("备注")
nr("商户照片") = sr("商户照片")
nr("商户编号") = sr("商户编号")
nr("客户ID") = sr("客户ID")
nr("法人姓名") = sr("法人姓名")
nr("机具ID") = sr("机具ID")
nr("机具条码") = sr("机具条码")
dr("商户ID") = nr("商户ID")
dr("商户名称") = nr("商户名称")
dr("客户ID") = nr("客户ID")
dr("客户姓名") = nr("法人姓名")
dr("是否绑定") = True
nr("流量卡ID")=dr("流量卡ID")
nr("流量卡号")=dr("流量卡号")
Dim lsjl As DataRow = DataTables("流量卡绑定商户历史记录表").Find("流量卡号='" & dr("流量卡号") & "' and 解绑日期 is null")
If lsjl IsNot Nothing Then
lsjl ("解绑日期") =Date.Today
lsjl = DataTables("流量卡绑定商户历史记录表").addnew
lsjl ("流量卡ID") =dr("流量卡ID")
lsjl ("流量卡号") =dr("流量卡号")
lsjl ("类型") =dr("类型")
lsjl ("商户ID") =dr("商户ID")
lsjl ("商户名称") =dr("商户名称")
lsjl ("客户ID") =dr("客户ID")
lsjl ("客户姓名") =dr("客户姓名")
End If
msgbox("流量卡成功绑定商户 ")
End If
End If
有点蓝老师按您的思路写了还是同样的错误,麻烦您给看看这段代码错误的地在哪?
[此贴子已经被作者于2017/9/25 21:09:46编辑过]