求助报错代码出错
当Combo1.Text 选择"管理系统net版"时,table_name <> "设置" 报错信息(MsgBox "请选择正确11-1地址")是对的,但是当combo1.text选择 "管理系统1"table_name <> "设置"报错信息还是报(MsgBox "请选择正确11-1地址"),而不是报(MsgBox "请选择正确22-1数据库"),不知道代码错在哪里,请高手看看,以下是代码
If Combo1.Text = "管理系统net版" And ListName1 <> "" Or ListName2 <> "" Then
'调用数据库连接过程
Call OpenConn
'检查两表是否存在
Dim F As Boolean
Set rs = cn.OpenSchema(adSchemaTables)
Do Until rs.EOF
If rs!TABLE_TYPE = "TABLE" Then
'List1.AddItem rs!table_name
If rs!table_name = "设置" Then
F = True
Exit Do
Else
F = False
End If
End If
rs.MoveNext
Loop
If rs.State = 1 Then rs.Close
If F = False Then MsgBox "请选择正确11-1地址", 16: Exit Sub
'执行更新sql语句
cn.Execute "Update 设置 set 值= '11' where 参数名='服务器'"
Call CloseConn
'调用数据库连接过程
Call OpenConn2
F = False
Set rs = cn.OpenSchema(adSchemaTables)
Do Until rs.EOF
If rs!TABLE_TYPE = "TABLE" Then
'List1.AddItem rs!table_name
If rs!table_name = "信息" Then
F = True
Exit Do
Else
F = False
End If
End If
rs.MoveNext
Loop
If rs.State = 1 Then rs.Close
If F = False Then MsgBox "请选择正确11-2地址", 16: Exit Sub
'调用数据库连接过程
cn.Execute "update 信息 set 值='11' Where 参数名='服务器'"
'调用信息窗口过程
MsgBox ("恭喜您,可以正常使用啦!"), 64
'调用数据库关闭过程
Call CloseConn2
ElseIf Combo1.Text = "管理系统1" And ListName1 <> "" Or ListName2 <> "" Then
'调用数据库连接过程
Call OpenConn
Set rs = cn.OpenSchema(adSchemaTables)
Do Until rs.EOF
If rs!TABLE_TYPE = "TABLE" Then
'List1.AddItem rs!table_name
If rs!table_name = "设置" Then
F1 = True
Exit Do
Else
F = False
End If
End If
rs.MoveNext
Loop
If rs.State = 1 Then rs.Close
If F = False Then MsgBox "请选择正确22-1数据库", 16: Exit Sub
'执行更新sql语句
cn.Execute "Update 设置 set 值= '22' where 参数名='data'"
Call CloseConn
'调用数据库连接过程
Call OpenConn2
F = False
Set rs = cn.OpenSchema(adSchemaTables)
Do Until rs.EOF
If rs!TABLE_TYPE = "TABLE" Then
'List1.AddItem rs!table_name
If rs!table_name = "信息" Then
F = True
Exit Do
Else
F = False
End If
End If
rs.MoveNext
Loop
If rs.State = 1 Then rs.Close
If F = False Then MsgBox "请选择正确的22-2数据库", 16: Exit Sub
'调用数据库连接过程
cn.Execute "update 信息 set 值='22' Where 参数名='data'"
'调用信息窗口过程
MsgBox ("恭喜您,可以正常使用啦!"), 64
'调用数据库关闭过程
Call CloseConn2