need help wth a database

  • Thread starter Thread starter John
  • Start date Start date
J

John

hi Everybody,

I'm working on a Web site that reads a simple database file created in
Access.

The Web site has an asp page called results.asp and I used Frontpage to
design it. Part of the asp page is a table (comes standard with Frontpage)
and this table gets filled with the data from the database file based on a
custom query

There are 3 scenarios:

1. I need to display all the data from the database file and the URL and
custome query look like this:

http://localhost/data/result.asp

SELECT * FROM tblData ORDER BY Year DESC,

2. I need to display all the data that match certain year

http://localhost/data/result.asp?Year=2006

SELECT * FROM tblData WHERE (Year = ::Year::)
ORDER BY Year DESC


3. I need to display all the data that match certain name

http://localhost/data/result.asp?Name=Smith

SELECT * FROM tblData WHERE (Name = ::Name::)
ORDER BY Year DESC

My question is how do I combine all 3 above SQL statements into one.

TIA
 
<%
if request.querystring("Name")<>"" then
SELECT * FROM tblData WHERE (Name = ::Name::) ORDER BY Year DESC
elseif request.querystring("year")<>""
SELECT * FROM tblData WHERE (Year = ::Year::) ORDER BY Year DESC
else
SELECT * FROM tblData ORDER BY Year DESC
end if
%>
 
The Web site has an asp page called results.asp

This newsgroup is specifically for ASP.NET.

Please post questions about ASP Classic here:
microsoft.public.inetserver.asp.general

Please post questions about ASP Classic and database connectivitiy here:
microsoft.public.inetserver.asp.db

There are also specific newsgroups for Frontpage and Access...
 
Back
Top