復制代碼 代碼如下:
<%@LANGUAGE="VBSCRIPT"%>
<%
option explicit
dim startime,endtime,conn,strCon,db
startime=timer()
Dim strSQLServerName
Dim strSQLDBUserName
Dim strSQLDBPassword
Dim strSQLDBName
'請填寫數據庫具體參數
'-----------------------------------------------------------------------------------------------
strSQLServerName = "127.0.0.1" '服務器名稱或地址
strSQLDBUserName = "sa" '數據庫帳號
strSQLDBPassword = "123" '數據庫密碼
strSQLDBName = "bbsbak" '數據庫名稱
'-----------------------------------------------------------------------------------------------
'SQL Server OLE Driver
Set conn = Server.CreateObject("ADODB.Connection")
strCon = "Provider=SQLOLEDB;Server=" & strSQLServerName & ";User ID=" & strSQLDBUserName & ";Password=" & strSQLDBPassword & ";Database=" & strSQLDBName & ";"
conn.Open strCon
function CloseDatabase
Conn.close
Set conn = Nothing
End Function
%>