This is a multi-part message in MIME format.
------=_NextPart_000_0008_01C45933.30136C80
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I'm trying to use a recordset inside of a function but I'm getting an =
"object required 'adoRS" error. =20
At the top of the page I create my recordset, ex:
dim strConnection, adoCN, adoRS, strSQL
strConnection =3D <Connection>
Set adoCN =3D server.CreateObject("ADODB.connection")
Set adoRS =3D server.CreateObject("ADODB.recordset")
adoCN.Open strConnection
adoRS.ActiveConnection =3D adoCN
adoRS.CursorLocation =3D adUseClient
strSQL =3D "SELECT ... "
adoRS.open strSQL
then further down the page I call a function GetRecords(). The function =
looks like this:
function GetRecords()
adoRS.movefirst
var1 =3D adoRS("field1")
...........etc
end function
I'd rather not have the whole recordset inside of the function since I =
also use it on other parts of the page. What am I doing wrong?
Thanks
------=_NextPart_000_0008_01C45933.30136C80
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>I'm trying to use a recordset inside of a function =
but I'm=20
getting an "object required 'adoRS" error. </FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>At the top of the page I create my recordset, =
ex:</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>dim strConnection, adoCN, adoRS, strSQL</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>strConnection =3D <Connection><BR>Set adoCN =
=3D=20
server.CreateObject("ADODB.connection")<BR>Set adoRS =3D=20
server.CreateObject("ADODB.recordset")<BR>adoCN.Open=20
strConnection<BR>adoRS.ActiveConnection =3D =
adoCN<BR>adoRS.CursorLocation =3D=20
adUseClient</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>strSQL =3D "SELECT ... "</FONT></DIV>
<DIV><FONT size=3D2>adoRS.open strSQL</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>then further down the page I call a function=20
GetRecords(). The function looks like this:</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>function GetRecords()</FONT></DIV>
<DIV><FONT size=3D2> adoRS.movefirst</FONT></DIV>
<DIV><FONT size=3D2> var1 =3D =
adoRS("field1")</FONT></DIV>
<DIV><FONT size=3D2> =20
...........etc</FONT></DIV>
<DIV><FONT size=3D2>end function</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>I'd rather not have the whole recordset inside of =
the function=20
since I also use it on other parts of the page. What am I doing=20
wrong?</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Thanks</FONT></DIV></BODY></HTML>
------=_NextPart_000_0008_01C45933.30136C80--