I am working on a mini application and I have to retrieve and save USER_ID in a table.
It works like this; I input the email address of the user and then the statement has to retrieve USER_ID and save it into a table.
I am having problem with my SQL Like statement. Its just that I have to insert only the first part of the email address. For example, "
[email protected]". I insert only "thomas"; not remaining part.
Here are sample of the statement and resulting message I am getting in my
Java console:
Code:
String ea = txt_email.getText();
String lid = "SELECT USER_ID FROM user WHERE email_address Like '"+ea+"%' ";
Error Message:
Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression ''SELECT USER_ID FROM user WHERE email_address Like 'thomas%' ''.