SQL help

M

matt shudy

Hi,

I have a page were db results are displayed... I am
using a sql statement,

strSQL = "SELECT * FROM Schools ORDER BY Year ASC, Month
ASC, Day ASC"

I want to add a WHERE to the statement. I have tried
adding this right after Schools

WHERE School = '" & Request.Form("School") & "'

but it didn't work. I am using a mySQL database, and am
using asp code to get records from the db. Does anyone
know what i did wrong?

Thanks,

Matt Shudy
 
J

Jim Buyens

-----Original Message-----
Hi,
Howdy.

I have a page were db results are displayed... I am
using a sql statement,

strSQL = "SELECT * FROM Schools ORDER BY Year ASC, Month
ASC, Day ASC"

I want to add a WHERE to the statement. I have tried
adding this right after Schools

WHERE School = '" & Request.Form("School") & "'

but it didn't work. I am using a mySQL database, and am
using asp code to get records from the db. Does anyone
know what i did wrong?

If your SQL statement was:

strSQL = "SELECT * FROM Schools WHERE School = '" &
Request.Form("School") & "' ORDER BY Year ASC, Month ASC,
Day ASC"

then the syntax looks OK, provided the Schools table has a
field named School.

How exactly did this fail? For example, what was the error
message or bad behavior?

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
|| Microsoft FrontPage Version 2002 Inside Out
|| Web Database Development Step by Step .NET Edition
|| Troubleshooting Microsoft FrontPage 2002
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top