这个错误是点确定按钮后出现的,而且只有部分客户端会出现。确定按钮的代码如下:
'**********切换数据源************
Dim ljip As String = e.Form.Controls("txtIP").Value
Dim s As String = "Provider=SQLOLEDB.1;Password=Server2008;Persist Security Info=True;User ID=sa;" & _
"Initial Catalog=excel;Data Source=" & e.Form.Controls("txtIP").Value & "\MSSQLSERVER," & e.Form.Controls("txtPort").Value
If Connections.TryConnect(s) = False Then
MessageBox.Show("数据源无法连通!")
Return
Else
Dim cn As Connection = Connections("wjexcel")
If cn.ConnectionString <> s Then
If Connections.Contains("wjexcel") Then
Connections.Delete("wjexcel")
End If
Connections.add("wjexcel",s)
End If
End If
'******加载用户,数据登记,权限表*******
Dim bn() As String = {"FtUser","tabRepData","FTtabQX","FTtabQXBt","FTcaidanQX","FTdaohangQX","FTbdkjQX","FT个人" & _
"便签","Ft自动编码规则表","Ft用到自动编码的表和列","Ft自动编码已编最大号","Ft临时编码表","流程设置表","流程进" & _
"度表","流程临时表","流程数据主表","流程数据明细"}
vars("stop") = True
For i As Integer = 0 To bn.Length - 1
If DataTables.Contains(bn(i)) = False Then
DataTables.Load(bn(i))
Tables(bn(i)).Visible = False
End If
Next
vars("stop") = False
Functions.Execute("sjbtldafzsx")
'If DataTables.Contains("Ft自动编码规则表") = False Then
'DataTables.Load("Ft自动编码规则表|Ft用到自动编码的表和列|Ft自动编码已编最大号|Ft临时编码表")
'Tables("Ft自动编码规则表").Visible = False
'Tables("Ft用到自动编码的表和列").Visible = False
'Tables("Ft自动编码已编最大号").Visible = False
'Tables("Ft临时编码表").Visible = False
'End If
'************找到对应用户名***************
Dim UserName As String = e.Form.Controls("txtUserName").Value
Dim dr As DataRow
If UserName = "" Then
Messagebox.show("请输入用户!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
dr = DataTables("FtUser").SQLFind("[FtID] = '" & UserName & "'")
If dr Is Nothing Then
Messagebox.show("此用户不存在!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
If e.Form.Controls("txtPassword").Value = dr("Password") Then
_UserFtID = UserName
_UserName = dr("Name")
_UserGroup = dr("Group")
_UserSGroup = dr("上层部门")
_DeptID = dr("DeptID")
_OperID = dr("OperID")
Else
Messagebox.show("密码错误!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
'生成数据表
Dim cmd As New SQLCommand
cmd.C
cmd.CommandText = "Sel ect OperID,{tabDepartment}.DeptID,{tabDepartment}.sName,{tabRole}.RoleID,{tabRole}.sName " & _
"Fr om ({tabRoleOper} Inn er J OIN {tabDepartment} ON {tabDepartment}.[DeptID] = {tabRoleOper}.[DeptID]) Inner JOIN " & _
"{tabRole} ON {tabRole}.[RoleID] = {tabRoleOper}.[RoleID] Where OperID = " & _OperID
_URGTable = cmd.ExecuteReader()
For Each urgdr As DataRow In _URGTable.DataRows
_UserRGroups.add(urgdr("sName") & "." & urgdr("sName1"))
If _UserDeptIDs.Contains(urgdr("DeptID")) = False Then
_UserDeptIDs.add(urgdr("DeptID"))
End If
Next
'***********登陆openQQ和系统**************
If QQClient.Ready Then
MessageBox.show("QQClient已经启动,请先关闭","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
QQClient.ServerIP = e.Form.Controls("txtIP").Value '指定服务器IP地址
QQClient.ServerPort = e.Form.Controls("QQPort").Value '指定服务器端口
QQClient.UserName = _UserSGroup & "." & _UserName'指定登录用户名
QQClient.Password = e.Form.Controls("txtPassword").Value
If QQClient.Start() = True '如果登录成功
Dim msg As String = "恭喜,OpenQQ登录成功!"
If QQClient.ServerMessage > "" Then '如果服务器返回了欢迎信息
msg = msg & QQClient.ServerMessage
End If
popMessage(msg,"提示",PopiconEnum.Infomation,2)
e.Form.Close
Else '如果登录失败,显示服务器返回错误信息
PopMessage("QQClient登录失败,原因:" & vbcrlf & QQClient.ServerMessage,"提示",PopiconEnum.Error,5)
Return
End If
'*****************************************
'**************系统菜单是否显示*********
Dim y As Boolean
For Each js As String In _UserRGroups
Dim bmjs() As String = js.Split(".")
If bmjs(1) = "《系统管理》" Or bmjs(1) = "《设计》" Then
y = True
End If
Next
If y = True Then
RibbonTabs("SM").Groups("DesignFun").Visible = True
RibbonTabs("SM").Groups("SqGn").Visible = True
QAT.Items("Save").Visible = True
Else
RibbonTabs("SM").Groups("DesignFun").Visible = False
RibbonTabs("SM").Groups("SqGn").Visible = False
QAT.Items("Save").Visible = False
End If
'***********************************
'************检测是否有到期工作便签*********
Dim bqdr As DataRow = DataTables("FT个人便签").SQLFind("人员ID = " & _OperID & " and 预计完成日期 <= '" & Date.Today & "'and 预计完成日期 <>'' and 结束日期 = ''")
If bqdr IsNot Nothing Then
Forms("未读消息提示").Open()
Forms("未读消息提示").Text = "有到期工作便签提醒"
Forms("未读消息提示").Controls("来源").text = "便签"
Forms("未读消息提示").Controls("来源").Visible = False
Forms("未读消息提示").Controls("Label1").text = "你有已到期工作便" & vbcrlf & " 签,请及时确认!"
End If
'**********读取硬件信息*******************
If ljip = "192.168.1.123" Then
Functions.AsyncExecute("读取电脑硬件")
End If