'备份数据库并提供下载的asp文件
<%
Response.Buffer=true
Response.Clear
'根据你的情况修改用户名和密码
constr="Provider=SQLOLEDB.1;Persist Security Info=True;User ID=用户名;Password=密码;Data Source=(local)"
set conn=server.createobject("adodb.connection")
conn.open constr
bkfname=server.mappath("数据库备份.bak")
sqlstr="backup database pubs to disk='"+bkfname+"' with init"
conn.execute sqlstr
conn.close
set fn=server.createobject("adodb.stream")
fn.mode=3
fn.type=1
fn.open
fn.LoadFromFile bkfname
Response.ContentType="application/octet-stream"
Response.BinaryWrite fn.read
fn.close
%>
<%
Response.Buffer=true
Response.Clear
'根据你的情况修改用户名和密码
constr="Provider=SQLOLEDB.1;Persist Security Info=True;User ID=用户名;Password=密码;Data Source=(local)"
set conn=server.createobject("adodb.connection")
conn.open constr
bkfname=server.mappath("数据库备份.bak")
sqlstr="backup database pubs to disk='"+bkfname+"' with init"
conn.execute sqlstr
conn.close
set fn=server.createobject("adodb.stream")
fn.mode=3
fn.type=1
fn.open
fn.LoadFromFile bkfname
Response.ContentType="application/octet-stream"
Response.BinaryWrite fn.read
fn.close
%>