2012-09-17 126 views
0

對不起,前景不好。這基本上是一個asp網站的.inc文件。目前,我們已經從當前的MySQL遷移到MSSQL 2008.在MySQL中,我無法連接到數據庫。但我無法在MSSQL 2008下連接它。該腳本在MySQL中正常工作。請幫助。ADO連接字符串錯誤

Information 1 : I'm using Dreamweaver.

Information 2 : I have tried strConnect = "Provider=sqloledb;Library=DBMSSOCN;Data Source=xx.xx.xx.xx;1433; Initial Catalog=mydatabasename;User Id=userID;Password=password;"

Information 3 : I can't access to the database thru the website, this is the error msg i get 500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed.

Information 4 :i'm lost for ideas. I searched everywhere in http://www.connectionstrings.com/sql-server-2008, http://support.microsoft.com/kb/238949, still no luck.

Information 5 : I have tried using .udl file to get the connection string. Whenever i test connection, it works perfectly shows connection passed

`<% On Error Resume Next 
Set objConn = Nothing 
strConnect = "Provider=sqloledb;Network Library=DBMSSOCN;Data Source=ABC-EF-SQLS01" 
    "Initial Catalog=mydatabasename;" 
    "User Id=userID;Password=password;" 
Set objConn = Server.CreateObject("ADODB.Connection") 
objConn.Open strConnect 


Function UserIP() 

    UserIP = Request.ServerVariables ("HTTP_X_FORWARD_FOR") 

    If UserIP = "" Then 

     UserIP = Request.ServerVariables ("REMOTE_ADDR") 

    End If 

End Function 


Function BinaryToString(Binary) 


    Dim cl1, cl2, cl3, pl1, pl2, pl3 
    Dim L 
    cl1 = 1 
    cl2 = 1 
    cl3 = 1 
    L = LenB(Binary) 

    Do While cl1<=L 
    pl3 = pl3 & Chr(AscB(MidB(Binary,cl1,1))) 
    cl1 = cl1 + 1 
    cl3 = cl3 + 1 
    If cl3>300 Then 
     pl2 = pl2 & pl3 
     pl3 = "" 
     cl3 = 1 
     cl2 = cl2 + 1 
     If cl2>200 Then 
    pl1 = pl1 & pl2 
    pl2 = "" 
    cl2 = 1 
     End If 
    End If 
    Loop 
    BinaryToString = nl2br(pl1 & pl2 & pl3) 
End Function 

Function nl2br(str) 
    If Not isNull(str) Then 
     nl2br=replace(str,VbCrLf, "<br >&nbsp; ") 
    End If 
End function 

Function AddZeros(str) 

    iLength = len(str) 
    iZeros = 9 - iLength 

    For i=1 to iZeros 

     str = "0" & str 

    Next 

    AddZeros = "<font color=green><b>AKC-"&str&"</b></font>" 

End Function 

Function DisplayDateFormat(str) 
    arrDate = Split(CStr(str),"/") 
    DisplayDateFormat = arrDate(1)&"-"&arrDate(0)&"-"&arrDate(2) 

End Function 


Function DBDateFormat(str) 


End Function 

Function doubleQuote(ByVal fixText) 
    doubleQuote = Replace(fixText, "'", "''") 
End Function 

%>

回答

1

應該

提供程序= SQLOLEDB;網絡庫= DBMSSOCN;數據源= XX.XX.XX.XX,1433

注意逗號爲明確的端口和網絡字。

儘管最好只使用Data Source = xxxx;

並通過cliconfg中的xxxx別名設置網絡庫細節