请问在程序中建立ACCESS数据库时如何给数据库加上密码?

programfish 2003-10-18 11:05:08
如上。
...全文
49 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
programfish 2003-10-18
  • 打赏
  • 举报
回复
是在自己的程序中动态建立数据库时。
射天狼 2003-10-18
  • 打赏
  • 举报
回复
以独占的方式打开,菜单"工具/安全/设置数据库密码"~~
programfish 2003-10-18
  • 打赏
  • 举报
回复
用DAO呢。
阿建像熊猫 2003-10-18
  • 打赏
  • 举报
回复
http://expert.csdn.net/Expert/topic/2029/2029652.xml?temp=.1231806
可以参考。
阿建像熊猫 2003-10-18
  • 打赏
  • 举报
回复
Groups and Users Append, ChangePassword Methods Example (VB)

This example demonstrates the Append method of Groups, as well as the Append method of Users by adding a new Group and a new User to the system. The new Group is appended to the Groups collection of the new User. Consequently, the new User is added to the Group. Also, the ChangePassword method is used to specify the User password.

' BeginGroupVB
Sub GroupX()

Dim cat As ADOX.Catalog
Dim usrNew As ADOX.User
Dim usrLoop As ADOX.User
Dim grpLoop As ADOX.Group

Set cat = New ADOX.Catalog
cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\Program Files\" & _
"Microsoft Office\Office\Samples\Northwind.mdb;" & _
"jet oledb:system database=c:\samples\system.mdb"

With cat
'Create and append new group with a string.
.Groups.Append "Accounting"

' Create and append new user with an object.
Set usrNew = New ADOX.User
usrNew.Name = "Pat Smith"
usrNew.ChangePassword "", "Password1"
.Users.Append usrNew

' Make the user Pat Smith a member of the
' Accounting group by creating and adding the
' appropriate Group object to the user's Groups
' collection. The same is accomplished if a User
' object representing Pat Smith is created and
' appended to the Accounting group Users collection
usrNew.Groups.Append "Accounting"

' Enumerate all User objects in the
' catalog's Users collection.
For Each usrLoop In .Users
Debug.Print " " & usrLoop.Name
Debug.Print " Belongs to these groups:"
' Enumerate all Group objects in each User
' object's Groups collection.
If usrLoop.Groups.Count <> 0 Then
For Each grpLoop In usrLoop.Groups
Debug.Print " " & grpLoop.Name
Next grpLoop
Else
Debug.Print " [None]"
End If
Next usrLoop

' Enumerate all Group objects in the default
' workspace's Groups collection.
For Each grpLoop In .Groups
Debug.Print " " & grpLoop.Name
Debug.Print " Has as its members:"
' Enumerate all User objects in each Group
' object's Users collection.
If grpLoop.Users.Count <> 0 Then
For Each usrLoop In grpLoop.Users
Debug.Print " " & usrLoop.Name
Next usrLoop
Else
Debug.Print " [None]"
End If
Next grpLoop

' Delete new User and Group objects because this
' is only a demonstration.
.Users.Delete "Pat Smith"
.Groups.Delete "Accounting"

End With

End Sub
' EndGroupVB

7,759

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧