" End if 'step1 建立数据库 Sub CreateDB(StrDBName) Dim Conn '数据库连接 Dim StrDSN '数据库连接字符串 Dim StrCmd '命令字符串 StrDSN="driver={SQL server};server="&StrServer&";uid="&StrUid&";pwd="&StrSaPwd&";database=master" '建立和数据库master的连接 set Conn = Server.CreateObject("ADODB.Connection") Conn.Open StrDSN '新建一数据库 StrCmd="CREATE DATABASE "&StrDBName Conn.execute(StrCmd) Conn.Close Set Conn=Nothing End Sub 'step2 导入数据 sub RestoreDB(StrDBName,fromBak) SQL="Restore database " & StrDBName & " from disk='"&Server.MapPath(fromBak)&"'"