CrimsonDiva
Programmer
Hello,
I've had SEVERAL problems creating successful ADO connections with ASP and SQL Server 2000. I have an ASP connection file that has the following information (connection string altered for security):
<%
'Connection.asp
Dim objconn, ConnTemp
'opens the connection to the db
Function openDB()
'Dim objconn, ConnTemp
on error resume next
set objconn=Server.Createobject("ADODB.Connection"
set connTemp=Server.Createobject("ADODB.Connection"
'connection string
objconn.open "PROVIDER=SQLOLEDB;DATA SOURCE=111.111.11.11;UID=nratler;PWD=123456;DATABASE=HTC"
connTemp.open "PROVIDER=SQLOLEDB;DATA SOURCE=111.111.11.11;UID=nratler;PWD=123456;DATABASE=HTC"
if err.number <> 0 then
response.write Err.Description
end if
End Function
There is also a similar CloseDB() function that closes out the connections.
Question 1: The first problems arise when I try to move the DIM into the function instead of outside the function(commented out). When I move it into the function, it causes any page that calls this file to give a 500 internal error. Therefore, I MUST declare the connections outside of the function. Why is that?
Question 2: When I leave the DIM outside of the function, I STILL notice problems with connection strings in other ASP files that include this file:
<!--#include file="../connection.asp"-->
Call OpenDB()
Set rstemp=Server.CreateObject("Adodb.RecordSet"
rstemp.cursorlocation = aduseclient
rstemp.Open mySQL, objconn
intrecords=rstemp.recordcount
.
.
.
When I try to run the code above, I get this error message:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
Why? What's the problem? I've been struggling with this for weeks. Please help!![[sadeyes] [sadeyes] [sadeyes]](/data/assets/smilies/sadeyes.gif)
I've had SEVERAL problems creating successful ADO connections with ASP and SQL Server 2000. I have an ASP connection file that has the following information (connection string altered for security):
<%
'Connection.asp
Dim objconn, ConnTemp
'opens the connection to the db
Function openDB()
'Dim objconn, ConnTemp
on error resume next
set objconn=Server.Createobject("ADODB.Connection"
set connTemp=Server.Createobject("ADODB.Connection"
'connection string
objconn.open "PROVIDER=SQLOLEDB;DATA SOURCE=111.111.11.11;UID=nratler;PWD=123456;DATABASE=HTC"
connTemp.open "PROVIDER=SQLOLEDB;DATA SOURCE=111.111.11.11;UID=nratler;PWD=123456;DATABASE=HTC"
if err.number <> 0 then
response.write Err.Description
end if
End Function
There is also a similar CloseDB() function that closes out the connections.
Question 1: The first problems arise when I try to move the DIM into the function instead of outside the function(commented out). When I move it into the function, it causes any page that calls this file to give a 500 internal error. Therefore, I MUST declare the connections outside of the function. Why is that?
Question 2: When I leave the DIM outside of the function, I STILL notice problems with connection strings in other ASP files that include this file:
<!--#include file="../connection.asp"-->
Call OpenDB()
Set rstemp=Server.CreateObject("Adodb.RecordSet"
rstemp.cursorlocation = aduseclient
rstemp.Open mySQL, objconn
intrecords=rstemp.recordcount
.
.
.
When I try to run the code above, I get this error message:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
Why? What's the problem? I've been struggling with this for weeks. Please help!
![[sadeyes] [sadeyes] [sadeyes]](/data/assets/smilies/sadeyes.gif)