如何给ACCESS数据库加密,但vb可以访问

来源:百度知道 编辑:UC知道 时间:2024/05/15 18:49:03
我用vb做了个简单的管理软件,想给数据库加个密码,但是不影响vb对数据库的访问,密码设为123,这个程序对吗?怎么出错误提示呢?
conn.Connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\note.mdb;password="+123+""
错误提示为“应用程序无法打开,工作信息文件丢失,或已被其他用户以独占的方式打开”,哪位高手给我讲讲啊,我是以独占的方式给数据库加密的,是不是不对啊?具体该怎么做呢,先谢谢啊

这是因为密码是错误的.
conn.Connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\note.mdb;password="+123+""
这个语句表示密码为+123+,而不是123
正确的语句是:
conn.Connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\note.mdb;password=123"
如果将123用变量表示的话
dim a as string'定义变量
set a=123'将a赋值为123

conn.Connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\note.mdb;password='" + a +"'

conn.Connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\note.mdb;password=123"

conn.Connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\note.mdb;password="+123+""

password="123""

为什么是+123+ ?

password=123"

加油啊