ADO连接字符串错误

时间:2012-09-17 03:57:10

标签: sql-server-2008 connection-string ado

对于凌乱的前景感到抱歉。这基本上是asp网站的.inc文件。目前,我们已经从当前的MySQL迁移到MSSQL 2008.在MySQL中,我能够连接到数据库。但我无法在MSSQL 2008下连接它。该脚本在MySQL中工作正常。请帮助。

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

%GT;

0 个答案:

没有答案