Hi,

I have an area of web page that I do query to display display some
information. It is basically a Select statement to display everything in the
table, which loops around till everything is displayed. That works fine and
dandy.
I want to create three buttons to display information for "Past 24 Hours",
"Past 72 Hours", and "All Entry's"

I am not sure the best way to do this, any ideas?

OH, the select statement for 24 hours, 72, or all entries I have but the
part I am not sure is how to put the code into the buttons.

thanks in advance,

Re: Sql query via a form button on a web page. by LakeGator

LakeGator
Fri Dec 30 12:27:51 CST 2005

Assuming that you are calling an ASP called Query_Time.aso and you have
a column called StartDate in tblAppointments that contains the date to
be used for your time periods you can use a query string of, say, Hours
to specify how many hours you wish to query via different buttons in
your page:

<form method="POST" action="Query_time.asp?hours=0">
<input type="submit" value="All" name="BAll">
</form>
<form method="POST" action="Query_time.asp?hours=24">
<input type="submit" value="24 hours" name="B24">
</form>
<form method="POST" action="Query_time.asp?hours=72">
<input type="submit" value="72 hours" name="B72">
</form>

The key code in Query_Time.asp would be something like:

If Request.QueryString("Hours") = 0 or Request.QueryString("Hours") =
"" Then
strSQL = "SELECT * From tblAppointments"
Else
intHours = - Request.QueryString("Hours")
strSQL = "SELECT * From tblAppointments Where StartDate > #" &
DateAdd("h",intHours,Now()) & "#"
End If


RE: Sql query via a form button on a web page. by Woohoo

Woohoo
Tue Jan 03 15:05:02 CST 2006

Thanks a bunch.....

This is actually what I was looking for.

"Woohoo" wrote:

>
> Hi,
>
> I have an area of web page that I do query to display display some
> information. It is basically a Select statement to display everything in the
> table, which loops around till everything is displayed. That works fine and
> dandy.
> I want to create three buttons to display information for "Past 24 Hours",
> "Past 72 Hours", and "All Entry's"
>
> I am not sure the best way to do this, any ideas?
>
> OH, the select statement for 24 hours, 72, or all entries I have but the
> part I am not sure is how to put the code into the buttons.
>
> thanks in advance,
>
>
>
>