Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2011
    Thanked 0 Times in 0 Posts

    SQL Server 2008 DB Connection

    I am trying to connect to a SQL Server database, not hosted on the web. I have tried multiple variations of the connection string below, but all have failed. Unfortunately I simply get an "Internal Server" error. Please help!

    objOrdersConn.Open "Provider=sqloledb; Data Source=<ipaddress>,1433;network library=DBMSSOCN;Initial Catalog=SPI; User ID=<uid>; Password=<pw>"

    I am assuming the Initial Catalog is the name of the actual database (the SQL Server has numerous databases).

    I am able to ping the SQL Server over port 1433 so I do not believe it is the server denying the opening of the connection.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Thanked 4,839 Times in 4,800 Posts

    On Error Resume Next
        objOrdersConn.Open "Provider=sqloledb; ... etc. ... "
        If Err.Number > 0 Then
            Response.Write "Error #" & Err.Number & ": " & Err.Description & "<HR>"
        End If
        For e = 0 To objOrdersConn.Errors.Count-1
            Set oops = objOrdersConn.Errors(e)
            Response.Write "Connection error #" & oops.Number & ": " & oops.Description & "<HR>"
    On Error GoTo 0
    I think I remember that loop on the connection.Errors collection correctly.

    It *might* need to be
        For e = 1 To objOrdersConn.Errors.Count
    Try it both ways.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts