请各位大侠支招vb+access的问题!!
这是我用ActiveX EXE做的一个图书管理系统登陆界面的代码。两个TEXT用于接收用户 名和密码,一个按键是确定功能。运行时说是:找不到可安装的ISAM.在conn.Open 处
Private Sub cmdOK_Click()
Dim strUserName As String
Dim strPassword As String
Dim strTargetAsp As String
Dim conn As ADODB.Connection
Dim rslogin As ADODB.Recordset
Dim strSQL As String
If Trim(txtUserName.Text) = " " Then
MsgBox "“口令”不能为空 "
Exit Sub
Else
strUserName = Trim(txtUserName.Text)
End If
If Trim(txtPassWord.Text) = " " Then
MsgBox "“口令”不能为空 "
Exit Sub
Else
strPassword = Trim(txtPassWord.Text)
End If
'检查口令、用户身份
Set conn = New ADODB.Connection
conn.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;DataSource=C:\Documents and Settings\jsjzx1\桌面\工作二\book.mdb;Persist Security Info=False "
conn.Open '就这个地方
strUserName = Replace(strUserName, " ' ", " ' ")
strSQL = "select*from 职员 where username = ' " & strUserName & " 'and 口令= ' " & strPassword & " ' "
Set rslogin = conn.Execute(strSQL)
If rslogin.EOF Or rslogin.BOF Then
MsgBox "用户名或口令错误,请检查 ! "
txtPassWord.SelStart = 0
txtPassWord.SelLength = Len(txtPassWord.Text)
txtPassWord.SetFocus
Else
Select Case rslogin( "权限 ")
Case "领导 "
strTargetAsp = "LeadersMain.asp "
Case "主任 "
strTargetAsp = "ZHURENMAIN.asp "
Case "秘书 "
strTargetAsp = "MiShuMain.asp "
Case "图示管理员 "
strTargetAsp = "TuShuManagerMain.asp "
Case Else
strTargetAsp = "OthersMain.asp "
End Select
SaveSetting "JGYOA ", "Login ", "UserName ", strUserName
Hyperlink.NavigateTo "HTTP;// " & pIP & "/oa/ " & strTargetAsp
End If
'释放 变量
Set rslogin = Nothing
Set conn = Nothing
End Sub
[解决办法]
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=MyAccess.mdb;Persist Security Info=False "
[解决办法]
引用ADO控件,最好将数据库放在程序所在目录下,在代码中这样连接:
conn.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;DataSource= " & app.path & "\book.mdb;Persist Security Info=False "
[解决办法]
连接字符串不正确
[解决办法]
装ACCESS97或打VB补丁6
[解决办法]
DataSource改为Data Source
[解决办法]
引用ADO控件,最好将数据库放在程序所在目录下,在代码中这样连接:
conn.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;DataSource= " & app.path & "\book.mdb;Persist Security Info=False "