ASP实现SQL备份、恢复
程序员文章站
2022-07-02 08:45:13
1、备份 <% sql="backup database 数据库名 to disk='"&server.mappath("ba...
1、备份
<%
sql="backup database 数据库名 to disk='"&server.mappath("backup")&"\\"&"backuptext.dat"&"'"
set cnn=server.createobject("adodb.connection")
cnn.open "driver={sql server};server=服务器名;uid=sa;pwd="
cnn.execute sql
on error resume next
if err<>0 then
response.write "错误:"&err.descripting
else
response.write "数据备份成功!"
end if
%>绿色c hinaip ower. comayrcj6b
2、恢复
<%
sql="restore database 数据库名 from disk='"&server.mappath("backup")&"\\"&"backuptext.dat"&"'"
set cnn=server.createobject("adodb.connection")
cnn.open "driver={sql server};server=服务器名;uid=sa;pwd="
cnn.execute sql
on error resume next
if err<>0 then
response.write "错误:"&err.descripting
else
response.write "数据恢复成功!"
end if
%>
<%
sql="backup database 数据库名 to disk='"&server.mappath("backup")&"\\"&"backuptext.dat"&"'"
set cnn=server.createobject("adodb.connection")
cnn.open "driver={sql server};server=服务器名;uid=sa;pwd="
cnn.execute sql
on error resume next
if err<>0 then
response.write "错误:"&err.descripting
else
response.write "数据备份成功!"
end if
%>绿色c hinaip ower. comayrcj6b
2、恢复
<%
sql="restore database 数据库名 from disk='"&server.mappath("backup")&"\\"&"backuptext.dat"&"'"
set cnn=server.createobject("adodb.connection")
cnn.open "driver={sql server};server=服务器名;uid=sa;pwd="
cnn.execute sql
on error resume next
if err<>0 then
response.write "错误:"&err.descripting
else
response.write "数据恢复成功!"
end if
%>
上一篇: FSO操作文件系统
下一篇: 浏览文件夹下面所有图片