0

对不起,混乱的前景。这基本上是一个用于 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

%>

4

1 回答 1

1

应该

提供者=sqloledb;网络库=DBMSSOCN;数据源=xx.xx.xx.xx,1433

注意显式端口和网络字的逗号。

虽然最好只使用 Data Source=xxxx;

并通过 cliconfg 中的 xxxx 别名设置网络库细节

于 2012-09-19T01:07:13.357 回答