where StrSQL is a valid SQL String, be it INSERT, UPDATE, SELECT, DELETE, a SP, etc.
1b.) Creating an Active RecordSet :
[green]Please note that in saying 'Active' it means that the connection is open, that there is a record pointer, records are updateable, deleteable etc, not meaning that it's an active connection from server to client and bi-directional, it's only bi-directional from the web server to the data server ( if not same machine ) for the duration of the execution of code just like ASP it's server side only[/green]
Used for handling paged recordsets (see FAQ: http://www.tek-tips.com/faqs.cfm?fid=186), modifiable pointer based recordsets, and other 'special' method based recordsets.
[blue]Set RS = Server.CreateObject("ADODB.Recordset")
[green]this is where method/collection arguments and pre-populated recordset code would take place.[/green]
RS.Open StrSQL, ActiveConnection, CursorType, LockType, Options[/blue]
Documentation on what each of the arguments are rather involved, although StrSQL is of course the SQL statement and ActiveConnection would be the Connection Object Con.
For more information on the arguments for a recordset please see :
http://msdn.microsoft.com/library/en-us/ado270/htm/mdmscadoproperties.asp
2.) Manipulating the RecordSet :
At this point is where record output, pointer navigations and updates/deletes would take place these are covered in Segment 4 - Using a RecordSet
3.) Closing the RecordSet Object :
Just like in the Connection Object, this is one of the most often overlooked steps, or misplaced steps in coding, it is necessary to close the Recordset otherwise the residual connection will eat up available connection slots to the data source and eat up server memory.
[green]If step 1b was used[/green]
[blue]RS.Close[/blue]
[green]used for both steps 1a & 1b[/green]
[blue]Set RS = nothing[/blue]
This calls RS's Close method, hence closing the active recordset ( if opened ), and Set RS=nothing clears the server memory of the recordset object
Next Section : http://www.tek-tips.com/faqs.cfm?fid=3804
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.