Use a recordset inside a Function?
From: David Berry (dberry_at_mvps.org)
Date: 06/23/04
- Next message: bt: "Re:Re: ASP book recommendation???"
- Previous message: Aaron [SQL Server MVP]: "Re: ASP vs ASP.NET"
- Next in thread: Bob Barrows [MVP]: "Re: Use a recordset inside a Function?"
- Reply: Bob Barrows [MVP]: "Re: Use a recordset inside a Function?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 23 Jun 2004 15:03:05 -0400
I'm trying to use a recordset inside of a function but I'm getting an "object required 'adoRS" error.
At the top of the page I create my recordset, ex:
dim strConnection, adoCN, adoRS, strSQL
strConnection = <Connection>
Set adoCN = server.CreateObject("ADODB.connection")
Set adoRS = server.CreateObject("ADODB.recordset")
adoCN.Open strConnection
adoRS.ActiveConnection = adoCN
adoRS.CursorLocation = adUseClient
strSQL = "SELECT ... "
adoRS.open strSQL
then further down the page I call a function GetRecords(). The function looks like this:
function GetRecords()
adoRS.movefirst
var1 = 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
- Next message: bt: "Re:Re: ASP book recommendation???"
- Previous message: Aaron [SQL Server MVP]: "Re: ASP vs ASP.NET"
- Next in thread: Bob Barrows [MVP]: "Re: Use a recordset inside a Function?"
- Reply: Bob Barrows [MVP]: "Re: Use a recordset inside a Function?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|