asp sqlserver連接代碼

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
    

    下一條:SQL 2005 端口設置

    上一條:automation 服務器不能創(chuàng)建對象

棗莊西橋網(wǎng)絡微信小程序微信小程序

棗莊西橋網(wǎng)絡手機站二維碼掃描手機瀏覽

色久高清无码在线视频,午夜性色福利在线视频网站,亚洲区精品久久一区二区三区,免费观看日本激色视频网站