2016/12/8 9:08:151421 閱讀
Const SqlUsername = "----" 'SQL數(shù)據(jù)庫用戶名 Const SqlPassword = "----" 'SQL數(shù)據(jù)庫用戶密碼 Const SqlDatabaseName = "---" 'SQL數(shù)據(jù)庫名 Const SqlHostIP = "(local)" 'SQL主機IP地址。本地(指網(wǎng)站與數(shù)據(jù)庫在同一臺服務器上)可用“(local)”或“127.0.0.1”,非本機(指網(wǎng)站與數(shù)據(jù)庫分別在不同的服務器上)請?zhí)顚憯?shù)據(jù)庫服務器的真實IP) '以下代碼請勿改動 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ù)庫連接出錯,請檢查數(shù)據(jù)庫參數(shù)設置。" Response.End End If
微信小程序
掃描手機瀏覽