2016/12/8 9:08:151424 閱讀
Const SqlUsername = "----" 'SQL數(shù)據(jù)庫(kù)用戶(hù)名
Const SqlPassword = "----" 'SQL數(shù)據(jù)庫(kù)用戶(hù)密碼
Const SqlDatabaseName = "---" 'SQL數(shù)據(jù)庫(kù)名
Const SqlHostIP = "(local)" 'SQL主機(jī)IP地址。本地(指網(wǎng)站與數(shù)據(jù)庫(kù)在同一臺(tái)服務(wù)器上)可用“(local)”或“127.0.0.1”,非本機(jī)(指網(wǎng)站與數(shù)據(jù)庫(kù)分別在不同的服務(wù)器上)請(qǐng)?zhí)顚?xiě)數(shù)據(jù)庫(kù)服務(wù)器的真實(shí)IP)
'以下代碼請(qǐng)勿改動(dòng)
Dim Conn
Dim ConnStr
If SystemDatabaseType = "SQL" Then
ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlHostIP & ";"
Else
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(DBFileName)
End If
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open ConnStr
'Response.Write Err
If Err Then
Err.Clear
Set Conn = Nothing
Response.Write "數(shù)據(jù)庫(kù)連接出錯(cuò),請(qǐng)檢查數(shù)據(jù)庫(kù)參數(shù)設(shè)置。"
Response.End
End If
微信小程序
掃描手機(jī)瀏覽