请给个例子好吗?
不明白你要什么
数据库恢复:
Dim conn As New adodb.Connection
Dim rec As New adodb.Recordset
'SQLserver数据服务器名称;SQLuser数据服务器用户名称(一般为SA);SQLpaswd数据库用户密码
basename = "master"
temstring = "driver={SQL Server};server=" & SQLsever & ";database=" & basename & ";uid=" & SQLuser & ";pwd=" & SQLpaswd & ";"
restorefilename = "'" & Trim(Dir1.Path) & "'\'" & Trim(File1.FileName) & "'"
'Dir1.Path为数据库存放的目录;File1.FileName为数据库名称
conn.Open temstring
conn.Execute ("restore database bikemag from disk='" & restorefilename & "'")
conn.Close
数据库备份:
Dim conn As New adodb.Connection
Dim rec As New adodb.Recordset
Dim backupfilename As String '备份数据库存放地址以及名称
db = "Driver={SQL Server};Server=" & SQLserver & _
";Database=" & SQLbase & ";uid=" & SQLuser & ";pwd=" & SQLpaswd & ";"
conn.Open db '打开数据库连接
b = "backup database bikemag to disk='" & backupfilename & "'"
conn.Execute (b)
conn.close
另外SQL2000数据库可以手动进行数据库备份和恢复,不需要用代码执行