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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with select statement

Status
Not open for further replies.

chassid

MIS
Aug 27, 2000
58
US
B"H

I can't get this select statement to work! I am looking for for one fields and displaying these four fields: firstname, lastname, title, address if the search is found.

The select doesn't work and I get http 500 error.

Here it is:

objRS.Open "SELECT * FROM members, member_address, address, organization_address, organizations WHERE members.member_id = member_address.member_id AND member_addres.address_id = address.address_id AND address.address_id = organization_address.address_id AND organization-address.organization_id = organizations.organization_id AND " & strField & " LIKE '%" & strFor & "%' ORDER BY " & strOrderBy, objConn

Any help will be greatly appreciated.

Daniel
Do you know the Chabad Lubavitch Sheliach in your area?
He is waiting for you!
 
From a brief look it has probably got something to do with incorrect / and or missing delimeters. Regards

Big Dave


** If I am wrong I am sorry, but i'm only trying to help!! **

 
Look at my SQL it might help. If you're like me(i'm not a SQL programmer) just make your query in Access then look at the SQL(top left button)
Remeber all line must be in ONE with only one space between them...

Code:
SELECT TabHoraireCours.Date, TabHoraireCours.[8h00], TabHoraireCours.[8h30], TabHoraireCours.[9h00], TabHoraireCours.[9h30], TabHoraireCours.[10h00], TabHoraireCours.[10h30], TabHoraireCours.[11h00], TabHoraireCours.[11h30], TabHoraireCours.[12h00], TabHoraireCours.[12h30], TabHoraireCours.[13h00], TabHoraireCours.[13h30], TabHoraireCours.[14h00], TabHoraireCours.[14h30], TabHoraireCours.[15h00], TabHoraireCours.[15h30], TabHoraireCours.[16h00], TabHoraireCours.[16h30], TabHoraireCours.[17h00], TabHoraireCours.[17h30], TabHoraireCours.[18h00], TabHoraireCours.[18h30], TabHoraireCours.[19h00], TabHoraireCours.[19h30], TabHoraireCours.[20h00], TabHoraireCours.[20h30], TabHoraireCours.[21h00], TabHoraireCours.[21h30], TabHoraireCours.[22h00], TabHoraireCours.[22h30]
FROM TabHoraireCours
WHERE (((TabHoraireCours.NoLocal)="B1203"));

Hope it'll help

Sharky99 >:):O>
 
After a longer look at your CODE, it would be a lot easier if you post all the important details about your database

ie. table name
table fields
what are your criterias

i think what you're doing is not possible (the way you're doing it) looks like you're querying too many tables at the same time??? are they linked???

Sharky99 >:):O>
 
http 500

although an obtuse error, every time I've ever seen this error in my code (and I have seen it quite a few times), it's always my ASP code, and not the SQL...

You could test this theory by first assigning that sql statement to a local variable and the response.write()'ing that to the screen, taking it over to your db and trying to directly execute it there... then you'll know for sure what is causing the problem.

If it's not clear, the post the code for your page, and see if we can't get further with this...

I've had this error before for forgetting the language declaration at the top of the page:

<%@language=vbscript%>

hope that helps. :)
Paul Prewett
penny.gif
penny.gif
 
I just noticed that you'd misspelled the name of one of your tables:
you're using following spelling in one case

organization-address

and

organization_address

in another.
Try to fix that and see what'll happen.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top