freethinker23
asked on
Error using a wildcard in a SQL search
I have a text box that takes input from a user and I want to use that information to do a SQL search. I am searching on last name and I would like them to be able to do a partial search.
My current SQL statement is:
SELECT DISTINCT str_agent_number, str_agent_fname, str_agent_lname, num_agent_code, str_location_code, num_mbc_code, num_territory_number, str_address, str_city, str_zip, str_phone_number, str_state FROM tbl_sro_boatdeck INNER JOIN tbl_state_code_lookup ON tbl_sro_boatdeck.num_state _code = tbl_state_code_lookup.num_ state_code WHERE tbl_sro_boatdeck.str_agent _lname LIKE '" & txtLName.Text & "'"
When I put a % sign on either side of 'txtLName.Text' I receive an invalid character error. Please advise. thanks.
My current SQL statement is:
SELECT DISTINCT str_agent_number, str_agent_fname, str_agent_lname, num_agent_code, str_location_code, num_mbc_code, num_territory_number, str_address, str_city, str_zip, str_phone_number, str_state FROM tbl_sro_boatdeck INNER JOIN tbl_state_code_lookup ON tbl_sro_boatdeck.num_state
When I put a % sign on either side of 'txtLName.Text' I receive an invalid character error. Please advise. thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER