Set g_con = New ADODB.Connectiong_con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\dbase\JetDogCRM.mdb;Mode=ReadWrite;Persist Security Info=True;Jet OLEDB:DataBase Password='111'"加上这句Jet OLEDB:DataBase Password='111' 以后就会提示“无法安装ISM”
去掉就会因密码不对无法打开
去掉就会因密码不对无法打开
dim con as adodb.connection
dim ref as adodb.recordset
public function connects()
set con=new adodb.connection
con.provider="microsoft.jet.oledb.4.0"
con.connectionstring="data source = c:\abc.mdb"
con.open ,,"123" '用户名不知道应该写什么啊?大哥大姐们帮帮忙好不啦!
set ref=new adodb.recordset
ref.open "select * from table1",con,....
end function
或者
1、con.Provider = "Microsoft.Jet.OLEDB.4.0"
con.Properties("Jet OLEDB:Database Password") = "111"
con.Open "C:\ccc.mdb;Persist" 这个方法用于打开对ACCESS文件加密的方法。
2、"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=databaseName;User ID=userName;Password=userPassword;" 这个方法是用于打开设置了用户和组的密码
你用的是哪一种,你试一下总有一个可以
Public Function MyAppPath() As String
If Right$(App.Path, 1) = "\" Then
MyAppPath = App.Path
Else
MyAppPath = App.Path & "\"
End If
End Function'打开带密码的Access
Public Function ConnectString() _
As String
'
ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & MyAppPath & "\data\db.mdb") & _
";Jet OLEDB:Database Password =wumicat;Persist Security Info=False"
End Function