Here is an ASP code sample in VBScript:

<%
Dim x
Set x = server.CreateObject("ADODB.RECORDSET")
x.CursorType = 1
x.CursorLocation = 3
x.Fields.Append "custtype", adVarNumeric, 80, adFldMayBeNull
x.Open
x.addnew "custtype", 34
x.Update

call dothis(x)

Response.Write(x.RecordCount)

Set x = nothing

Function dothis(byval x)

x.addnew "custtype", 34
Response.Write(x.RecordCount & "<BR>")

x.addnew "custtype", 34
Response.Write(x.RecordCount & "<BR>")

set x = nothing

End Function

%>

This should run if you put it into an asp page and pull it from IIS.
It is just a disconnected recordset filled with a record and then a
response.write, etc.

Question: I'm using "byval" in the dothis() function, but SHOULD I
set x = nothing within the function? Obviously when using, "byref",
setting x = nothing will delete the instance of the object, but with
"byval" will I leave something in memory if I don't set x = nothing?

I think this is another "age old" question but I've got some pages
acting funky on a hosted server in Canada and I think this issue may
have something to do with it.

Re: byval and object instance by Bob

Bob
Sat Aug 20 10:27:57 CDT 2005

WG@. wrote:
> Here is an ASP code sample in VBScript:
>
Please don't multipost. I've already replied to this question over at
.asp.general. If you feel you must direct your question at multiple
newsgroups*, then post one single message to the desired groups by
putting the group names into the To list (aka crosspost)

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"