# Re: 如何储存密码资料

Posted by 阿晴 on March 04, 1998 at 05:39:44:

In Reply to: 如何储存密码资料 posted by PeaceMaker on March 02, 1998 at 22:55:58:

: vb6 如何储存密码资料, 使其无法被他人读取,
: 又或如何用运算的方式储存资料, 能否举例?
: 谢谢!

我想您应该是要将资料库加上密码吧? 用
CreateDatabase(App.Path & "\my.mdb",False,False,";Pwd=" & pwd)
pwd 是传入的密码. 如果您要用 Data Control 来开启这个资料库
记得将 Connect 设成 ;Pwd=密码. 例如:
With Data1
.DatabaseName=App.Path & "\my.mdb"
.RecordSource="mytable"
.Connect=";Pwd=" & pwd
.Refresh
End With
如果是用 DAO 的话则是用:
OpenDatabase(App.Path & "\my.mdb",False,False,";Pwd=" & pwd)

至于资料的编码方式您可以参考 "MicroSoft Visual Basic 5.0
Developer's Workshop" 第 16 章.

Follow Ups: