TryDim sDBFile AsString = "SERVER PATH"Dim sBackUpFile AsString = "D:\BACKUP"IfNot System.IO.Directory.Exists(sBackUpFile) Then
System.IO.Directory.CreateDirectory(sBackUpFile)
EndIf' a = Format$(Now.Date, "ddMMyyyy")
b = a
c1 = Now.ToLongTimeString
d = c1
c1 = c1.Replace(":", "")
c1 = c1.Replace(" ", "")
d = c1
sBackUpFile &= "\ABC.mdb"'First check the file u want to compact exists or not
If File.Exists(sDBFile) ThenDim db AsNew OleDb.OleDbConnection
'CompactDatabase has two parameters, creates a copy of compact DB at the Destination path
FileCopy(sDBFile, sBackUpFile)
EndIf'restore the original file from the compacted file
If File.Exists(sBackUpFile) Then
File.Delete(sBackUpFile)
File.Copy(sDBFile, sBackUpFile, True)
EndIfCatch ex As Exception
MsgBox(ex.Message)
EndTry
MsgBox("Backup of INTELPAT database was backedUp successfully !" & vbCrLf & "This Backup can bi found in D:\BACKUP\ABC_today'sdate.mdb ", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, )
此代码将复制整个数据库.... {S0的}
评论会员:米卡Wendelius 时间:2012/02/07
两个服务器之间的数据传输的另一种方式是使用链接服务器。欲了解更多信息,请参阅:]
此外,如果可能的话,可以考虑使用,而不是访问SQL Server。这将使事情更简单。您可以使用一个轻量级版本的SQL Server CE等,如