VB中ACCESS2000数据库的问题????(我给200分)

jwfgsf 2002-05-08 10:51:04
在VB中如何利用ADO修改ACCESS2000数据库的密码????

在VB中如何利用ADO压缩ACCESS2000数据库????

我要详细的例子:

我给200分。。。。。。。。。
...全文
78 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
sonicdater 2002-05-09
  • 打赏
  • 举报
回复
This example is got from MSDN
===================================================================

'Use ADOX:
'User.ChangePassword OldPassword, NewPassword
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
lovingkiss 2002-05-09
  • 打赏
  • 举报
回复
ADO压缩不了ACCESS2000数据库,只能是Adox,具体代码你搜索一下这里,好多详细的代码,太晚了,我就不找了;
改动密码,我只能是关注了;
water_j 2002-05-08
  • 打赏
  • 举报
回复
压缩的代码:
'压缩数据(库通过引用DAO对象)
Private Sub ComPactMyDB(DBFileName As String)
Dim OldFile As String
Dim NewFile As String

OldFile = DBFileName '待压缩数据库文件名
NewFile = App.Path & "\tmp.mdb" '压缩后的数据库文件名

DBEngine.CompactDatabase OldFile, NewFile

Kill OldFile '删除原来的文件
Name NewFile As OldFile '将压缩后的数据库文件名称改回去
End Sub

1,217

社区成员

发帖
与我相关
我的任务
社区描述
VB 数据库(包含打印,安装,报表)
社区管理员
  • 数据库(包含打印,安装,报表)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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