In classic ASP Is it possible to have one recordset which pulls all data from a table in the database and then create a second recordset on the same page which uses data in the original recordset? I just want a quick fix for right now to get this page working and I will make it better later. I have a need to use ALL data fields in the table in one section of this ASP page and then only SPECIFIC records from the table in another section of the same page.
If anyone can help me with this I really would appreciate it! Thanks guys!
How to re-use data returned in recordset using classic ASP?
I think I am missing something here.
When you retrieve data from a database, that data will continue to be available until the web page is closed or you do another retrieve of data.
If you are selecting multiple rows of data and you want this preserved for later use then either assign the data to variables or assign the data to an array.
Reply:Set rs = cn.Execute("SELECT * FROM Table1")
If Not rs.EOF Then
rs.MoveFirst
While Not rs.EOF
%%26gt;Hello %26lt;%= rs("FirstName").Value %%26gt; %26lt;%= rs("LastName").Value %%26gt;%26lt;%
Set rs2 = cn.Execute("SELECT * FROM Table2")
If Not rs2.EOF Then
rs2.MoveFirst
While Not rs2.EOF
%%26gt;%26lt;%= rs("FirstName").Value %%26gt; %26lt;%= rs("LastName").Value %%26gt;
%26lt;%
%26lt;%= rs2("Address").Value %%26gt;%26lt;%
Wend 'Not rs2.EOF
End If 'Not rs2.EOF
rs.Close
Set rs = Nothing
rs2.Close
Set rs2 = Nothing
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment