“无法获得连接句柄”怎么办啊
我用vb和sql做的旅游信息管理系统,在登录界面那里就进不去,出现“无法获得连接句柄”的问题。我觉得我所有的数据库连接的前期准备都做好了,包括在控制面板里设置数据源、在vb窗体中插入adodc控件、给adodc设置属性连接数据库。
要连接的adodc有11个,最后一个用户管理的adodc连接有点蹊跷。前面的10个设置好后,adodc的Recordsourc里是自动出
现了select from **的语句,还有用户是“sa”,而最后第11个这些都没有,害得我登录都不行,不知道怎么弄,请各位帮帮
吧 !
一下是那个用户管理窗体的代码:
Private Sub Cmd_Add_Click()
With UserEdit
.txtUserName = ""
.txtPass = ""
.txtPass2 = ""
.txtEname = ""
.Modify = False
.Show 1
End With
AdoUserList.Refresh
DataList1_Click
End Sub
Private Sub Cmd_Back_Click()
Unload Me
End Sub
Private Sub Cmd_Del_Click()
If DataList1.Text = "" Then
MsgBox "请选择要删除的用户"
Exit Sub
End If
If MyUser.UserName = "Admin" Then
MsgBox "此用户不能删除"
Exit Sub
End If
If MsgBox("是否删除当前用户", vbYesNo, "请确认") = vbYes Then
MyUser.Delete (DataList1.Text)
AdoUserList.Refresh
DataList1_Click
End If
End Sub
Private Sub Cmd_Modi_Click()
If DataList1.Text = "" Then
MsgBox "请选择要修改的用户"
Exit Sub
End If
With UserEdit
.OriUser = MyUser.UserName
.txtUserName = MyUser.UserName
.txtPass = MyUser.Pwd
.txtPass2 = MyUser.Pwd
.txtEname = MyUser.EmpName
If Format(MyUser.UserName, "<") = "admin" Then
.txtUserName.Enabled = False
End If
.Modify = True
.Show 1
End With
AdoUserList.Refresh
DataList1_Click
End Sub
Private Sub DataList1_Click()
If DataList1.Text = "" Then
Exit Sub
End If
MyUser.GetInfo (DataList1.Text)
lblUserName = MyUser.UserName
lblEmpName = MyUser.EmpName
If Format(MyUser.UserName, ">") = "admin" Then
lblUserType = "系统管理员"
Else
lblUserType = "普通用户"
End If
End Sub
Private Sub Form_Load()
lblUserType = ""
lblEmpName = ""
lblUserName = ""
End Sub
补充:VB , 控件