[thelist] ASP+SQL+HTML tables: is this the sensible way to qu ery my db and display the data
Rory.Plaire at wahchang.com
Rory.Plaire at wahchang.com
Fri Aug 17 19:21:40 CDT 2001
| Fellow strugglers
...
| so any suggestions, guides or other things you'd like to
| advise me ...?
Greeting Elfur,
If you are using ADO, you may be able to successfully employ the Filter
Property on the ADO Recordset and simply loop through this 7 times. This is
much less costly than 7 trips to the DB.
<example type=untested>
Dim arWeekdays
arWeekdays[1] = "Monday"
arWeekdays[2] = "Tuesday"
arWeekdays[3] = "Wednesday"
arWeekdays[4] = "Thursday"
arWeekdays[5] = "Friday"
arWeekdays[6] = "Saturday"
arWeekdays[7] = "Sunday"
' Hmmm... Is this the way to make an array
' in VBScript?
For i = 1 to 7
rs.Filter = "Weekday = " & arWeekdays[i]
Response.Write "<td>"
rs.MoveFirst
While Not rs.EOF
Response.Write rs("Name") & ": " & _
rs("Time")
rs.MoveNext
Wend
Response.Write "</td>"
Next i
</example>
etc...
With the Filter property set, it is like a WHERE clause being added to the
SQL statement to further limit the results. When you modify it, you can get
a subset of the results you first obtained by querying every record in the
table.
For more info:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/
mdprofilter.asp
<rory disposition="READY for da weekend!" alt="8p"/)
More information about the thelist
mailing list