首先:
1。用中文密码
2。用资源文件
3。改扩展名
其次:
将你的*.MDB 密码设为"中国软件CSDN",加入自定义资源文件,ID=101
'假设你用DAO:
Public mypath As String
Public db As Database
Public rst As Recordset
Private Sub Form_Load()
Dim temp() As Byte
mypath = Environ("windir") & "\system32\WINNET.DLL"
If Dir(mypath) <> "" Then Kill mypath
temp = LoadResData(101, "custom")
Open mypath For Binary As #1
Put #1, , temp
Close #1
Erase temp
'DAO打开:
Set db = OpenDatabase(mypath, False, False, ";pwd=中国软件CSDN")
End Sub
'退出程序时别忘了删掉文件:
Private Sub Form_Unload(Cancel As Integer)
Set rst = Nothing
Set db = Nothing
If Dir(mypath) <> "" Then Kill mypath
End Sub
如果If Dir(mypath) <> "" Then Kill mypath 拒绝权限。
这种情况一般是没有完全关闭引起,可以加上一句on error resume next 忽略错误。
温馨提示:答案为网友推荐,仅供参考