Connections string issue between 2005 and 2012

  • Hello I am trying to connect to a database from a server with SQL Server 2012 to SQL Server 2005 for some reason I cannot get it to work is there any known issues regarding? Do I need to add a different driver etc. or should this just work?

  • Meatloaf (1/7/2015)


    Hello I am trying to connect to a database from a server with SQL Server 2012 to SQL Server 2005 for some reason I cannot get it to work is there any known issues regarding? Do I need to add a different driver etc. or should this just work?

    Quick suggestion, post the connection string, full SQL and OS version information

    😎

    You can also check out www.connectionstrings.com[/url]

  • Thank you! Here is my code:

    Dim objConn, objRS, strQuery,strConnection

    set objConn = Server.CreateObject("ADODB.Connection")

    set objRS = Server.CreateObject("ADODB.RecordSet")

    strConnection = "User ID=xx;Password=xxxxxxxxxx;"

    strConnection = strConnection & "Driver={SQL Server};Server=DB_Server_NAME;Database=MY_DB;"

    objConn.Open strConnection

    strQuery = "select * FROM myTable"

    Set objRS = objConn.Execute(strQuery)

    if not objRS.EOF then

    objRS.MoveFirst

    vchEventDesc = objRS("vchDesc")

    iNbr = objRS("iNbr")

    dDate = objRS("dDate")

    end if

    if objRS.State = adStateOpen then

    objRS.Close

    end if

    set objRS = nothing

  • Meatloaf (1/7/2015)


    Thank you! Here is my code:

    Dim objConn, objRS, strQuery,strConnection

    set objConn = Server.CreateObject("ADODB.Connection")

    set objRS = Server.CreateObject("ADODB.RecordSet")

    strConnection = "User ID=xx;Password=xxxxxxxxxx;"

    strConnection = strConnection & "Driver={SQL Server};Server=DB_Server_NAME;Database=MY_DB;"

    objConn.Open strConnection

    strQuery = "select * FROM myTable"

    Set objRS = objConn.Execute(strQuery)

    if not objRS.EOF then

    objRS.MoveFirst

    vchEventDesc = objRS("vchDesc")

    iNbr = objRS("iNbr")

    dDate = objRS("dDate")

    end if

    if objRS.State = adStateOpen then

    objRS.Close

    end if

    set objRS = nothing

    Quick suggestion, add a Provider parameter to the connection string with the right version for the SQL Server you are connecting to, i.e. Provider=SQLOLEDB.1;Data Source=...

    😎

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply