Home > ASP Development > Multiple Queries in a single ASP page

Multiple Queries in a single ASP page



Hi All,



I'm new to this forum, so please bare with me if I make "stupid" mistakes...



I've been trying to find information about having multiple queries in a single ASP page.



Codes I've got:



strSQL = "SELECT * FROM table1, table2"

...

...

do until rs.EOF

...

<show records from table 1>

<show records from table 2>

...

rs.MoveNext

loop

rs.close

...




But when I run the page, it doesn't finish one table then move onto another table. it just runs 1 record of the first table then move onto the 1st record of 2nd table and loop from there.



is there a way I can display all the records from 1 table before moving onto another table?





If I can get some guidelines from you geniuses out there, that'll be very much appreciated!!





Many Thanks,

Knockem

    
Guest


You would have to do the queries separately.



Example:


Code:



Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Your ConnectionString"

Set rs1 = Conn.Execute("SELECT * FROM Table1")

If Not rs1.eof Then
do until rs1.eof
Write Table1 records
rs1.movenext
loop
End If

Set rs2 = Conn.Execute("SELECT * FROM Table2")

If Not rs2.eof Then
do until rs2.eof
Write Table2 records
rs2.movenext
loop
End If

Conn.Close
Set Conn = Nothing



Was this answer helpful ? Yes No   
Guest


Thank You Very Much!



it works!!



Very Much Appreciate!

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved