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

SQL-statement

Status
Not open for further replies.

KryptoS

Programmer
Feb 7, 2001
240
BE
Hi,

I have a choice list with my firstname en surname in it eg.
listbox values= "Frank Claes", "John Smith"

I have also a table in a database with the following fields
Members:
- MemberId
- MemberFirstName
- MemberSurName

Now I want to search the MemberId, I thought something like this:
sqlstmt="SELECT * FROM Members WHERE MemberFirstName||' '||MemberSurName='"+listbox.getSelectedItem()+"'";

Why doesn't this work? can someone help me?
 
Well, right here, you are searching for both names compared to a first name field. Show the output from printing your select statement, too, to ensure that it is right.

MWB.

Disclaimer:
Beware: Studies have shown that research causes cancer in lab rats.
 
Try this:

sqlstmt="SELECT * FROM Members
WHERE CONCAT(MemberFirstName, ' ', MemberSurName)="+
listbox.getSelectedItem();

Otto
 

Problem solved!!

sqlstmt="select * from members where MembersFistName+' '+MembersSurName='"+listbox.getSelectedItem()+"'";

this is it!!!

thanx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top