如何可以选择路径的备份acess数据库?

valhallen 2002-05-15 12:22:38
2个数据表
1.mdb
2.mdb
想把1.mdb 和 2.mdb备份再自己需要的路径
怎么实现 ?
...全文
7 点赞 收藏 6
写回复
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
thinkeasy 2002-05-15
至于备份可用CopyFile这一API来实现,它比VB的FileCopy好用一点
下面的是声明
Public Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long
其中bFailIfExists 可以用Boolean来表示,用来指定是不是覆盖目标文件的
其余两个是源文件和目标文件
回复
topgenehon 2002-05-15
把data控件的属性设置如:
在databasename里选择路径G:\vb98\SUTENDINFO.MDB,在recordsouse里选择表名,在recordsettype里选择类型0--table,connect里面选择数据类型如:access
回复
thinkeasy 2002-05-15
下面的程序可以出现一个打开文件夹对话框
Public Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BROWSEINFO) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long

Private Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type

'=======================================
'打开文件夹
'=======================================
Public Function GetDirName() As String
Dim bi As BROWSEINFO
Dim r As Long
Dim pidl As Long
Dim path As String
Dim pos As Integer
bi.pidlRoot = 0&

bi.lpszTitle = srtTitle
bi.ulFlags = 1
pidl = SHBrowseForFolder(bi)
path = Space$(512)
r = SHGetPathFromIDList(ByVal pidl&, ByVal path)
If r Then
pos = InStr(path, Chr$(0))
GetDirName = Left(path, pos - 1)
Else: GetDirName = ""
End If
End Function
回复
daryl715 2002-05-15
用commondialog控件选择路径
回复
gucs 2002-05-15
最简单就是COPY到另外的路径
回复
valhallen 2002-05-15
如果我希望自己让她备份再一个默认的路径又如何实现?
回复
发动态
发帖子

1180

社区成员

VB 数据库(包含打印,安装,报表)
申请成为版主
社区公告
暂无公告