T
tegryan
Hey All,
I'm trying to do something that should be very simple, but I think I've
been up for too many hours or something.
Basically, I have an asp application that uses a database connection,
and I want to declare (create) that connection in an include and use it
throughout the application in various functions. I've tried making the
connection object a public variable, a constant, making the functions
public, passing the connection object in byRef, byVal, etc... I just
can't get it to work. Is this not possible in classic ASP?
I should also mention that if I take this code out of the function it
works as expected.
Thanks!
Teg Ryan
Here is a sample of what i'm trying to do:
Include:
<%
public cn
public rs
public sql
set cn = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.RecordSet")
cn.Open "Provider=MSDASQL; Driver={Microsoft Access Driver (*.mdb)};
DBQ=[[path]];"
%>
Then here's one of the functions in the ASP file that has the include
at the top:
Function SQLSelect()
sql = "select * from TABLE"
rs.open sql,cn,3,3
... etc
End function
I'm trying to do something that should be very simple, but I think I've
been up for too many hours or something.
Basically, I have an asp application that uses a database connection,
and I want to declare (create) that connection in an include and use it
throughout the application in various functions. I've tried making the
connection object a public variable, a constant, making the functions
public, passing the connection object in byRef, byVal, etc... I just
can't get it to work. Is this not possible in classic ASP?
I should also mention that if I take this code out of the function it
works as expected.
Thanks!
Teg Ryan
Here is a sample of what i'm trying to do:
Include:
<%
public cn
public rs
public sql
set cn = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.RecordSet")
cn.Open "Provider=MSDASQL; Driver={Microsoft Access Driver (*.mdb)};
DBQ=[[path]];"
%>
Then here's one of the functions in the ASP file that has the include
at the top:
Function SQLSelect()
sql = "select * from TABLE"
rs.open sql,cn,3,3
... etc
End function