Getting query syntax correct (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


rikki -> Getting query syntax correct (3/13/2008 12:36:00)

I've set up a database result in frontpage, dieted it..
Can't get it work the way I would like..
If I enter the number and password- works.
If I enter the Lastname and password - doesn't work (but it should. Any ideas..
fp_sQry="SELECT * FROM BRYSON3A WHERE ((BOOKINGNUMBER =  ::BOOKINGNUMBER:: OR LASTNAME =  '::LASTNAME::') AND (PASSWORD =  '::PASSWORD::'))"




ou812 -> RE: Getting query syntax correct (3/13/2008 14:06:39)

Hmm, it looks okay. Maybe double check your form name and database name for "lastname" and make sure they're what you have?




rdouglass -> RE: Getting query syntax correct (3/13/2008 14:21:27)

quote:

fp_sQry="SELECT * FROM BRYSON3A WHERE ((BOOKINGNUMBER = ::BOOKINGNUMBER:: OR LASTNAME = '::LASTNAME::') AND (PASSWORD = '::PASSWORD::'))"


I suspect grouping. Try it this way:

fp_sQry="SELECT * FROM BRYSON3A WHERE ((BOOKINGNUMBER = ::BOOKINGNUMBER::) OR (LASTNAME = '::LASTNAME::')) AND (PASSWORD = '::PASSWORD::')"

See the diff? That help any?

EDIT: Either that or there's a space in there. Try a trim statement.




rikki -> RE: Getting query syntax correct (3/13/2008 16:04:07)

I tried that new query; checked spaces..
Same thing..
Error when I use Lastname and password:
Database Results Error
Description: Extra ) in query expression '((BOOKINGNUMBER = ) OR (LASTNAME = 'tucker')) AND (PASSWORD = 'tucker1')'.
Number: -2147217900 (0x80040E14)
Source: Microsoft JET Database Engine

One or more form fields were empty. You should provide default values for all form fields that are used in the query.
One or more form fields were empty. You should provide default values for all form fields that are used in the query.




ou812 -> RE: Getting query syntax correct (3/13/2008 16:19:52)

Ah, makes sense now.

The query isn't working since you don't have a booking number. Not sure how the diet stuff works, but are you able to create your query depending on logic? Or can you default booking number to something, since it won't matter because it is an OR?




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.109375