Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check qry before submitting

Status
Not open for further replies.

herschelrj

Programmer
Jan 12, 2005
24
0
0
US
I have a registration page that needs to check to see if the course is available before submitting for confirmation and bringing back an error if the course is not open. Anyway to have the form run that check before submitting to the database? Any help is appreciated...

herschelrj
 
In simple terms,

formpage.asp

you have coursenumber

submitpage.asp

sql=SELECT availability from mytable WHERE course='"&request.form("coursenumber")&"'

rs.open sql

if rs("availability") ="NO" then
response.write "Sorry. This course is not available"
Else
'do the update here and write out the confirmation.
end if

-DNG
 
if course number IS an actual number(in database setup int/long)

inserts a stext string
change WHERE course='"&request.form("coursenumber")&"';"

to

inserts number
WHERE course="&request.form("coursenumber")&";"

otherwise DNG's setup is logically correct

if need more help...post form code

Good Luck!

BSL
 
also i would also check if such a course exist

if not rs.eof then

if rs("availability") ="NO" then
response.write "Sorry. This course is not available"
Else
'do the update here and write out the confirmation.
end if

else
response.write "No such course."
end if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top