以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]index was outside the bounds of the array .  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=179685)

--  作者:dj68301367
--  发布时间:2022/9/3 14:30:00
--  [求助]index was outside the bounds of the array .
发布至客户的总是出现以下错误!服务端是Win7系统,会不会因为不是Sever导致的。
另外一个客户,同样的软件,就没出现过。

.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2022.6.22.1
错误所在事件:项目,Server
详细错误信息:
Index was outside the bounds of the array.

--  作者:有点蓝
--  发布时间:2022/9/3 16:06:00
--  
错误所在事件:项目,Server】这个是指openqq的服务端事件有问题

Index was outside the bounds of the array】指索引超界,应该是用到集合等地方有问题

--  作者:dj68301367
--  发布时间:2023/9/18 18:00:00
--  
老师,终于试出问题了,

图片点击可在新窗口打开查看此主题相关图片如下:无标题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

--  作者:有点蓝
--  发布时间:2023/9/18 20:15:00
--  
服务端代码 
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 dt as datatable  = cmd.ExecuteReader
    If dt.datarows.Count > 0 Then
dim dr as datarow = dt.datarows(0)
        Dim Smx As Long = dr("StrMax") + 1
        e.ReturnValue = dr("ParNo") & format(smx, dr("StrLong"))
        cmd.CommandText = "U PDATE {BDLB} SET strmax = " & smx & " WHERE Itid = " & dr("itid")
        cmd.ExecuteNonQuery()
    End If
End If

另外服务端UserLogging代码发上来看看