Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO Rs Management

Status
Not open for further replies.

Quehay

Programmer
Feb 6, 2000
804
US
I've inherited a web app to maintain and modify. I'm used to ADO, but in a fat-client setting. I'm still figuring out to what extent global (asa or include) functions can pass connection and rs objects.

The sub used in a globalinclude file is:

[tt]Sub SetUpAndOpenRecordSet(ByRef rsRS, strSource)

set rsRS=Server.CreateObject("ADODB.Recordset")
rsRS.ActiveConnection="dsn=ECAP;"
rsRS.Source = strSource
'rsRS.CursorType = 0
'rsRS.CursorLocation = 2
rsRS.CursorType = 2
rsRS.CursorLocation = 3
rsRS.LockType = 3
rsRS.Open

End Sub
[/tt]

It's called thus: [tt]

SetupAndOpenRecordset rsProcesses, strSQL[/tt]

Here's the question(s): This gives a working recordset in the local sub, and I'm now going back and putting in cleanup to .Close and Set = Nothing at the local level.

Does the rsRS in the globalsub still remain open?

Would it be better to make the global sub a function that RETURNS a Rs object and then closes the Rs object in the global sub? Jeff Roberts
Analysis, Design, & Implementation
RenaissanceData.com
 
If the object has global scope, than anything you do to manipulate that object in global or less scope still affects the same object. Thus closing the global recordset in a nested sub is the same as closing the object on the global level.
Concerning passing recordsets from functions: I am actually not sure if this is possible. I have ateempted to do so in the past and had little luck with it, but if you manage to make it work please let me know. When I tried I was fairly new to ASP and could not get it to work at all, it may be that I was only making a minor error and did not realize it.
-Tarwn The three most dangerous things in the world are a programmer with a soldering iron, a hardware type with a program patch, and a user with an idea
-computer saying (Wiz Biz - Rick Cook)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top