January 7, 2015 at 4:47 am
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?
January 7, 2015 at 6:17 am
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
😎
January 7, 2015 at 7:06 am
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
January 7, 2015 at 8:28 am
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