ASP程序备份MSSQL库
当前位置:点晴教程→知识管理交流
→『 技术文档交流 』
[color=blue]dim[/color] strfilename,objrs,strsql
strfilename=[color=red]request[/color]("filename") [p][/p] '[color=red]response.write[/color]([color=red]left[/color](strfilename,18)) 'response.end() [color=blue]set[/color] fso = [color=red]server.createobject[/color]("scripting.filesystemobject") [color=blue]if[/color] fso.folderexists([color=red]left[/color](strfilename,18)) [color=blue]then[/color] '判断是否存在备份文件夹 [color=blue]if[/color] fso.fileexists(strfilename) [color=blue]then[/color] '判断是否存在备份文件夹 fso.deletefile(strfilename) fso.createfile(strfilename) 'response.write("删除文件后再创建") [color=blue]end if[/color] [color=blue]else[/color] fso.createfolder(left(strfilename,18)) '创建备份文件夹文件 'response.write("创建了文件夹") [color=blue]end if[/color] [color=blue]set[/color] fso =[color=blue] nothing[/color] [p][/p] [color=blue]set[/color] objrs=[color=red]server.createobject[/color]("adodb.recordset") strsql="backup database " & sqldbname & " to disk='" & strfilename & "' with format,name='full backup of tradedb/sql'" [color=red]'response.write[/color](strsql) [color=red]'response[/color].end() objrs.open strsql,conn,[color=red]1[/color],[color=red]3[/color] [color=blue]if[/color] [color=red]err.number[/color]=[color=red]0[/color] [color=blue]then [/color] 'objrs.close strsql="select * from backuprecord" objrs.[color=red]open[/color] strsql,conn,[color=red]1[/color],[color=red]3[/color] objrs[color=red].addnew[/color] objrs("backuptime")=[color=red]now[/color] objrs("name")=[color=red]session[/color]("user") objrs.[color=#ff0000]update[/color] objrs.[color=#ff0000]close[/color] [color=red]response.write[/color] "" [color=red]response[/color].[color=blue]end[/color] [p][color=blue]else[/color][/p] objrs.[color=red]close[/color] [color=red]response.write [/color]"" response.[color=blue]end [/color] [p][color=blue]end if [/color][/p] [color=blue]set[/color] objrs=[color=blue]nothing[/color] conn.[color=red]close[/color] [color=blue]set[/color] conn =[color=blue] nothing[/color] 该文章在 2010/7/3 13:34:22 编辑过 |
关键字查询
相关文章
正在查询... |