老师,终于试出问题了,此主题相关图片如下:无标题20230918.png
如上图所示,如果我点击界面的“X"关闭窗体,侧会弹出一个MSG确认窗体,如果我点取消,返回。再点击保存命令,就会出现以上错误
保存命令代码: e.Form.Controls("Text订单编号").text = Functions.Execute("QQClientSendWait", "GetBH@_销售订单")
QQClientSendWait 代码:
Dim dh As String = Nothing
If QQClient.Ready = False Then Functions.Execute("SetServer")
If QQClient.Ready = True Then
Do
dh = QQClient.SendWait(args(0), 5)
Loop While dh = ""
End If
Return dh
SetServer 代码
If QQClient.Ready = False Then
Do While QQClient.Ready = False
If Vars("ServerIP").Contains(":") = False Then Vars("ServerIP") = Forms("Main").Controls("TextServerIP").Text
If Vars("ServerIP").Contains(":") Then
Dim Sips() As String = Vars("ServerIP").split(":")
QQClient.ServerIP = sips(0)
QQClient.ServerPort = sips(1)
QQClient.Start()
End If
Loop
End If
服务端代码
Dim msg As String = e.Message
If msg.StartsWith("GetBH@_") Then
Dim Bname As String = msg.Split("_")(1)
cmd.CommandText = "Sel ect * From {BDLB} Where [Name] = '" & Bname & "'"
Dim vas = cmd.ExecuteValues
If vas.Count > 0 Then
Dim Smx As Long = vas("StrMax") + 1
e.ReturnValue = vas("ParNo") & format(smx, vas("StrLong"))
cmd.CommandText = "U PDATE {BDLB} SET strmax = " & smx & " WHERE Itid = " & vas("itid")
cmd.ExecuteNonQuery()
End If
End If