asp无组件备份与还原数据库(3)
作者:魔术师·杨 时间:2007-09-24 13:19:00
备份到设备:
<%
rec li,"select name,phyname from master..sysdevices where status=16"
%>
<select name="b_dev">
<%
while not li.eof
response.Write "<option value="&li(0)&">"&li(0)&"(文件:"&li(1)&")</option>"
li.movenext
wend
cdb li
%>
</select><br>
<input name="按钮" type="button" value="备份数据库" onClick="window.location=’cmd.asp?action=backup&database=’+document.all.b_data.value+’&dev=’+document.all.b_dev.value;">
<input name="按钮" type="button" value="还原数据库" onClick="window.location=’cmd.asp?action=RESTORE&database=’+document.all.b_data.value+’&dev=’+document.all.b_dev.value;"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
cmd.asp
<!--#include file="conn.asp"-->
<%
on error resume next
if request("action") <> "" then
if request("action")="backup" then
sql ="BACKUP DATABASE "&request("database")&" To "& request("dev")
cmd sql
if err.number > 0 then
response.Write "<script language=javascript>alert(’数据库"&request("database")&"备份失败!’);window.location=’default.asp’;</script>"
else
response.Write "<script language=javascript>alert(’数据库"&request("database")&"备份成功!’);window.location=’default.asp’;</script>"
end if
else
sql ="RESTORE DATABASE "&request("database")&" From "& request("dev")
cmd sql
if err.number > 0 then
response.Write "<script language=javascript>alert(’数据库"&request("database")&"还原失败!’);window.location=’default.asp’;</script>"
else
response.Write "<script language=javascript>alert(’数据库"&request("database")&"还原成功!’);window.location=’default.asp’;</script>"
end if
end if
end if
%>
希望大家互相交流!QQ:1168064
标签:备份,还原,数据库
0
投稿
猜你喜欢
glow工具在命令行读取Markdown好物分享
2022-06-19 11:59:34
Python全栈之进程和守护进程
2021-11-25 18:05:44
js动态显示当前日期,时间和星期代码
2007-08-14 12:31:00
怎样使MySQL在攻击者面前保持安全
2008-11-17 20:09:00
Python插入Elasticsearch操作方法解析
2021-08-30 01:47:09
使用torchtext导入NLP数据集的操作
2023-08-19 16:07:10
js 浏览器版本及版本号判断函数2009年
2024-04-28 09:40:54
sqlserver 动态创建临时表的语句分享
2012-01-29 17:54:37
一个假冒的序列号被用来注册Internet Download Manager,IDM正在退出的解决办法
2022-10-12 03:19:40
如何用Python绘制棒棒糖图表
2021-05-02 06:26:33
教你快速上手Selenium爬虫,万物皆可爬
2022-01-02 18:44:31
Python数据类型之String字符串实例详解
2022-01-08 11:38:50
Python3使用requests包抓取并保存网页源码的方法
2022-05-27 06:48:38
Python urllib库如何添加headers过程解析
2023-01-09 00:07:35
python re的findall和finditer的区别详解
2022-05-19 23:04:33
TypeScript新语法之infer extends示例详解
2024-03-13 20:42:27
细线表格的处理
2008-08-06 12:53:00
python中的sys模块和os模块
2021-07-06 00:43:17
带你轻松接触MySQL数据库的出错代码列表
2008-12-31 15:06:00
实例讲解SQL Server加密功能
2024-01-24 04:05:15