CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Web 开发 >  ASP

将用asp写的备份数据库的五个文件代码粘出来。但请教的是我无论怎么样在BackUpDB.asp中填写用户名和密码,都提示错误!

楼主CheerYang(射雕不准是技术问题,不快是思想问题)2004-05-02 14:41:19 在 Web 开发 / ASP 提问

将用asp写的备份数据库的五个文件代码粘出来。但请教的是我无论怎么样在BackUpDB.asp中填写用户名和密码,都提示错误!  
   
  以下是代码区  
   
  '****************  
  '         BackupDB.asp               备份数据选择  
  '******************  
  <%@     Language=VBScript     %>  
  <HTML>  
  <HEAD>  
  <META     name=VI60_defaultClientScript     content=VBScript>  
  <META     NAME="GENERATOR"     Content="Microsoft     FrontPage     4.0">  
  <SCRIPT     ID=clientEventHandlersVBS     LANGUAGE=vbscript>  
  <!--  
   
  Sub     btnbak_onclick  
                  if     frmbak.txtsvr.value=""     then  
                                  window.alert("''Server     Name''     is     empty!")  
                                  frmbak.txtsvr.focus  
                                  exit     sub  
                  end     if  
                  if     frmbak.txtuid.value=""     then  
                                  window.alert("''Administrators''     is     empty!")  
                                  frmbak.txtuid.focus  
                                  exit     sub  
                  end     if  
                  if     frmbak.txtdb.value=""     then  
                                  window.alert("''Database''     is     empty!")  
                                  frmbak.txtdb.focus  
                                  exit     sub  
                  end     if  
                  if     frmbak.txtto.value=""     then  
                                  window.alert("''Backup     To''     is     empty!")  
                                  frmbak.txtto.focus  
                                  exit     sub  
                  end     if  
                  frmbak.submit  
  End     Sub  
   
  -->  
  </SCRIPT>  
  <link     rel="stylesheet"     href="../../sheets/B2BStyle.css">  
  </HEAD>  
  <form     action="backupdbsave.asp"     method="post"     id=frmbak     name=frmbak>  
  <body     class="bg_frame_up">  
  <p     class=heading>&nbsp;数据库     -->     备份</p>  
  <P     align=center>  
  <div     align="center">  
          <center>  
                          <table     width="60%"     cellpadding=1     cellspacing=1     border=0     align=center>  
                                  <tr>  
                                          <td     class=TD_Mand_FN     align="center"     height="35"     width="40%">服务器名字:</td>  
                                          <td     class=TD_Mand_F     height="35"     width="59%">&nbsp;      
                                                  <INPUT     id=txtsvr     name=txtsvr     size="20"     style="font-family:     Arial;     font-size:     9pt"   value="showfray"></td>  
                  </tr>  
                  <tr>  
                                          <td     class=TD_Mand_FN     align="center"     height="35"     width="40%">用户名:</td>  
                                          <td     class=TD_Mand_F     height="35"     width="59%">&nbsp;      
                                                  <INPUT     id=txtuid     name=txtuid     size="20"     style="font-family:     Arial;     font-size:     9pt"   value="sa"></td>  
                  </tr>  
                  <tr>  
                                          <td     class=TD_Mand_FN     align="center"     height="35"     width="40%">口令:</td>  
                                          <td     class=TD_Mand_F     height="35"     width="59%">&nbsp;      
                                                  <INPUT     id=txtpwd     name=txtpwd     type=password     style="font-family:     Arial;     font-size:     9pt"></td>  
                  </tr>  
                  <tr>  
                                          <td     class=TD_Mand_FN     align="center"     height="35"     width="40%">数据库名:</td>  
                                          <td     class=TD_Mand_F     height="35"     width="59%">      
                                                  <p     align="left">&nbsp;  
                                                  <INPUT     id=txtdb     name=txtdb     size="20"     style="font-family:     Arial;     font-size:     9pt"   value="zhoa"></p>  
                  </td>  
                  </tr>  
                                   
                                          <td     class=TD_Mand_FN     align="center"     height="35"     width="40%">备份到:<br>  
                                                  <u>(服务器路径)</u></td>          
                                          <td     class=TD_Mand_F     height="35"     width="59%">&nbsp;      
                                                  <input     id=txtto     name=txtto     style="font-family:     Arial;     font-size:     9pt"   value="c:\"   size="59"></td>          
                  </tr>          
  </table>      
  </center>     </div>          
  <p     align=center><input     id=btnbak     name=btnbak     type=button     value="开始备份"     style="font-family:     Arial;     font-size:     9pt"></p>          
  </body>          
  </form>          
  </HTML>          
   
   
  '*************  
  '       BackupDBSave.asp                 备份数据保存页面  
  '**************  
   
  <%@     Language=VBScript     %>  
  <%  
  dim     msvr,muid,mpwd,mdb,mto  
  msvr=Request.Form("txtsvr")  
  muid=Request.Form("txtuid")  
  mpwd=Request.Form("txtpwd")  
  mdb=Request.Form("txtdb")  
  mto=Request.Form("txtto")  
  if     mpwd=""     then     mpwd="''''"  
   
  on     error     resume     next  
  set     dmosvr=server.CreateObject("SQLDMO.SQLServer")  
  dmosvr.connect     msvr,muid,mpwd  
   
  if     err.number>0     then     Response.Redirect("http:backuperr.asp?err="&err.number)  
   
  mdevname="Backup_"&muid&"_"&mdb  
  set     dmodev=server.CreateObject("SQLDMO.BackupDevice")  
  dmodev.name=mdevname  
  dmodev.type=2  
  dmodev.PhysicalLocation=mto  
  dmosvr.BackupDevices.Add     dmodev  
   
  if     err.number>0     then     Response.Redirect("http:backuperr.asp?err="&err.number)  
   
  set     dmobak=server.CreateObject("SQLDMO.Backup")  
  dmobak.database=mdb  
  dmobak.devices=mdevname  
  %>  
  <HTML>  
  <HEAD>  
  <META     NAME="GENERATOR"     Content="Microsoft     Visual     Studio     6.0">  
  </HEAD>  
  <body     background="../../Images/dot.gif">  
   
  <p><strong>正在备份,请稍候.....</strong></p>  
  <%  
  dmobak.sqlbackup     dmosvr  
  if     err.number>0     then     Response.Redirect("http:backuperr.asp?err="&err.number)  
   
  dmosvr.backupdevices(mdevname).remove  
  set     dmobak=nothing  
  set     dmodev=nothing  
  dmosvr.disconnect  
  set     dmosvr=nothing  
  %>  
  <p><strong>数据库     ''<%=mdb%>''     备份成功!</strong></p>  
  </BODY>  
  </HTML>  
   
   
  '*****************  
  '           BackupErr.asp                               备份数据出错提示页面  
  '******************  
  <%@     Language=VBScript     %>  
  <%  
  dim     errno,errstr  
  errno=Request.QueryString("err")  
  errstr=""  
  select     case     cstr(errno)  
                  case     "18456"  
                                  errstr="管理员用户名或密码错误!"  
                  case     "20482"  
                                  errstr="服务器名字错误或服务器不能连接!"  
                  case     "911"  
                                  errstr="该数据库不存在!"  
                  case     "15026"  
                                  errstr="服务器路径找不到!"  
                  case     "3201"  
                                  errstr="服务器路径找不到!"  
                  case     "3254"  
                                  errstr="restore     from     file     lawlessness!"  
                  case     else  
                                  errstr="unknown     error!     retry     later     please!"  
  end     select  
  %>  
  <HTML>  
  <HEAD>  
  <META     name=VI60_defaultClientScript     content=VBScript>  
  <META     NAME="GENERATOR"     Content="Microsoft     FrontPage     4.0">  
  <SCRIPT     ID=clientEventHandlersVBS     LANGUAGE=vbscript>  
  <!--  
   
  Sub     btnret_onclick  
                  history.back  
  End     Sub  
   
  -->  
  </SCRIPT>  
  <title></title>  
  </HEAD>  
  <body         class="bg_frame_up">  
  <p     align=center><font     color=#006666><%=errstr%></font></p>  
  <p     align=center><input     id=btnret     name=btnret     type=button     value=Return     style="font-family:     Arial;     font-size:     9pt"></p>  
  </BODY>  
  </HTML>  
   
   
  '下续  
   
  问题点数:0、回复次数:4Top

1 楼CheerYang(射雕不准是技术问题,不快是思想问题)回复于 2004-05-02 14:41:37 得分 0

'续上  
   
  '************  
  '     RestoreDB.asp                                         恢复数据选择页面  
  '************  
  <%@     Language=VBScript     %>  
  <HTML>  
  <HEAD>  
  <META     name=VI60_defaultClientScript     content=VBScript>  
  <META     NAME="GENERATOR"     Content="Microsoft     FrontPage     4.0">  
  <SCRIPT     ID=clientEventHandlersVBS     LANGUAGE=vbscript>  
  <!--  
   
  Sub     btnbak_onclick  
                  if     frmbak.txtsvr.value=""     then  
                                  window.alert("''Server     Name''     is     empty!")  
                                  frmbak.txtsvr.focus  
                                  exit     sub  
                  end     if  
                  if     frmbak.txtuid.value=""     then  
                                  window.alert("''Administrators''     is     empty!")  
                                  frmbak.txtuid.focus  
                                  exit     sub  
                  end     if  
                  if     frmbak.txtdb.value=""     then  
                                  window.alert("''Database''     is     empty!")  
                                  frmbak.txtdb.focus  
                                  exit     sub  
                  end     if  
                  if     frmbak.txtto.value=""     then  
                                  window.alert("''Restore     From''     is     empty!")  
                                  frmbak.txtto.focus  
                                  exit     sub  
                  end     if  
                  frmbak.submit  
  End     Sub  
   
  -->  
  </SCRIPT>  
  </HEAD>  
  <form     action="restoredbsave.asp"     method="post"     id=frmbak     name=frmbak>  
  <body     class="bg_frame_up">  
  <link     rel="stylesheet"     href="../../sheets/B2BStyle.css">  
   
  <p     class=heading>&nbsp;Database     -->     Restore</p>  
   
  <P     align=center>  
  <div     align="center">  
          <center>  
                          <table     width="60%"     height="71"     cellpadding=1     cellspacing=1     border=0     align=center>  
                                  <tr>  
                                          <td     class=TD_Mand_FN     align="center"     height="35"     width="40%">Server     Name:</td>      
                                          <td     class=TD_Mand_F     height="35">&nbsp;  
  <INPUT     id=txtsvr     name=txtsvr     size="20"     style="font-family:     Arial;     font-size:     9pt"></td>      
                  </tr>      
                  <tr>      
                                          <td     class=TD_Mand_FN     align="center"     height="35"     width="40%">Administrators:</td>      
                                          <td     class=TD_Mand_F     height="35">&nbsp;  
  <INPUT     id=txtuid     name=txtuid     style="font-family:     Arial;     font-size:     9pt"></td>      
                  </tr>      
                  <tr>      
                                          <td     class=TD_Mand_FN     align="center"     height="35"     width="40%">Password:</td>      
                                          <td     class=TD_Mand_F     height="35">&nbsp;  
  <INPUT     id=txtpwd     name=txtpwd     type=password     style="font-family:     Arial;     font-size:     9pt"></td>      
                  </tr>      
                  <tr>      
                                          <td     class=TD_Mand_FN     align="center"     height="35"     width="40%">Database:</td>      
                                          <td     class=TD_Mand_F     height="35">&nbsp;  
  <INPUT     id=txtdb     name=txtdb     style="font-family:     Arial;     font-size:     9pt"></td>      
                  </tr>      
                  <tr>      
                                          <td     class=TD_Mand_FN     align="center"     height="35"     width="40%">Restore      
                                                  From:<br>  
                                                  <u>(Server     Path)</u></td>              
                                          <td     class=TD_Mand_F     height="35">&nbsp;  
  <input     id=txtto     name=txtto     style="font-family:     Arial;     font-size:     9pt"></td>              
                  </tr>              
  </table></center>              
  </div>              
  <p     align=center><input     id=btnbak     name=btnbak     type=button     value="Start     Restore"     style="font-family:     Arial;     font-size:     9pt"></p>              
  </body>              
  </form>              
  </HTML>          
   
  '*************  
  '       RestoreDBSave.asp                           恢复数据过程页面  
  '*************  
   
  <%@     Language=VBScript     %>  
  <%  
  dim     msvr,muid,mpwd,mdb,mto  
  msvr=Request.Form("txtsvr")  
  muid=Request.Form("txtuid")  
  mpwd=Request.Form("txtpwd")  
  mdb=Request.Form("txtdb")  
  mto=Request.Form("txtto")  
  if     mpwd=""     then     mpwd="''''"  
   
  on     error     resume     next  
  set     dmosvr=server.CreateObject("SQLDMO.SQLServer")  
  dmosvr.connect     msvr,muid,mpwd  
   
  if     err.number>0     then     Response.Redirect("http:backuperr.asp?err="&err.number)  
   
  mdevname="Restore_"&muid&"_"&mdb  
  dmosvr.backupdevices(mdevname).remove  
  err.clear  
   
  set     dmodev=server.CreateObject("SQLDMO.BackupDevice")  
  dmodev.name=mdevname  
  dmodev.type=2  
  dmodev.PhysicalLocation=mto  
  dmosvr.BackupDevices.Add     dmodev  
   
  if     err.number>0     then     Response.Redirect("http:backuperr.asp?err="&err.number)  
   
  set     dmores=server.CreateObject("SQLDMO.Restore")  
  dmores.database=mdb  
  dmores.devices=mdevname  
  %>  
  <HTML>  
  <HEAD>  
  <META     NAME="GENERATOR"     Content="Microsoft     Visual     Studio     6.0">  
  </HEAD>  
  <body         class="bg_frame_up">  
   
  <p><strong>正在恢复,请稍候...</strong></p>  
  <%  
  dmores.sqlrestore     dmosvr  
  if     err.number>0     then     Response.Redirect("http:backuperr.asp?err="&err.number)  
   
  set     dmores=nothing  
  set     dmodev=nothing  
  dmosvr.disconnect  
  set     dmosvr=nothing  
  %>  
  <p><strong>数据库     ''<%=mdb%>''     恢复成功!</strong></p>  
  </BODY>  
  </HTML>Top

2 楼lang11zi(微软菜虫)回复于 2004-05-02 15:03:48 得分 0

你搞个别动网的论坛看一下就ok了Top

3 楼huhanshan013(飞兵团将军)回复于 2004-07-05 09:54:40 得分 0

我页这样做了一下  
  提示是:  
  errstr="unknown     error!     retry     later     please!"  
   
  怎么办?  
  可能会是什么问题?Top

4 楼sfar(唏嘘2005)回复于 2004-07-05 10:07:19 得分 0

在页面上面加上错误处理,在页面前面加上on   error   resume   next,  
  打印错误:response.write   Err.DescriptionTop

相关问题

  • asp源代码!
  • 急需asp代码!!
  • asp代码问题
  • ASP代码问题?
  • 用ASP如何备份MSSQL?
  • 谁有压缩备份的程序原代码或方法
  • 如何在代码中实现备份pordaxs的数据库?
  • 备份access数据库原代码,看看错在哪里?
  • 求SQL备份与恢复的源代码!!!!!!!
  • 如何用代码实现mysql数据库备份?

关键词

  • 数据库
  • 用户
  • 服务器
  • asp
  • 备份
  • 用户名

得分解答快速导航

  • 帖主:CheerYang

相关链接

  • Web开发类图书

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo