|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
asp,你就只能等着微软给你解决,它不乐意你就只好悲催。而且asp跑在windows服务器上,windows服务器跟linux比起来简直弱爆了!server|备份|数据|数据库<formmethod="post"name="myform"action="?action=backupdatabase">
选择操纵:<INPUTTYPE="radio"NAME="act"id="act_backup"value="backup"><labelfor=act_backup>备份</label>
<INPUTTYPE="radio"NAME="act"id="act_restore"value="restore"><labelfor=act_restore>恢复</label>
<br>数据库名:<INPUTTYPE="text"NAME="databasename"value="<%=request("databasename")%>">
<br>文件路径:<INPUTTYPE="text"NAME="bak_file"value="c:$1.bak">(备份或恢复的文件路径)<br>
<inputtype="submit"value="断定"id=submit1name=submit1>
</form>
<%
SQLServer数据库的备份与恢复!
ifrequest("action")="backupdatabase"Then
dimsqlserver,sqlname,sqlpassword,sqlLoginTimeout,databasename,bak_file,act
sqlserver="localhost"
sqlname="sa"
sqlpassword="password"
sqlLoginTimeout=15
databasename=trim(request("databasename"))
bak_file=trim(request("bak_file"))
bak_file=replace(bak_file,"$1",databasename)
act=lcase(request("act"))
ifdatabasename=""then
response.write"inputdatabasename"
else
ifact="backup"then
Setsrv=Server.CreateObject("SQLDMO.SQLServer")
srv.LoginTimeout=sqlLoginTimeout
srv.Connectsqlserver,sqlname,sqlpassword
Setbak=Server.CreateObject("SQLDMO.Backup")
bak.Database=databasename
bak.Devices=Files
bak.Action=0
bak.Initialize=1
bak.Replace=True
bak.Files=bak_file
bak.SQLBackupsrv
iferr.number>0then
response.writeerr.number&"<fontcolor=red><br>"
response.writeerr.description&"</font>"
endif
Response.write"<fontcolor=green>备份乐成!</font>"
elseifact="restore"then
恢复时要在没有利用数据库时举行!
Setsrv=Server.CreateObject("SQLDMO.SQLServer")
srv.LoginTimeout=sqlLoginTimeout
srv.Connectsqlserver,sqlname,sqlpassword
Setrest=Server.CreateObject("SQLDMO.Restore")
rest.Action=0fulldbrestore
rest.Database=databasename
rest.Devices=Files
rest.Files=bak_file
rest.ReplaceDatabase=TrueForcerestoreoverexistingdatabase
iferr.number>0then
response.writeerr.number&"<fontcolor=red><br>"
response.writeerr.description&"</font>"
endif
rest.SQLRestoresrv
Response.write"<fontcolor=green>恢复乐成!</font>"
else
Response.write"<fontcolor=red>没有选择操纵</font>"
endif
endif
endif
%>
</p>asp是基于web的一种编程技术,可以说是cgi的一种。它可以完成以往cgi程序的所有功能,如计数器、留言簿、公告板、聊天室等等。 |
|