I have this simple sql that searches a database table field for a particular string that is passed by an asp form
area_name=trim(request.form("area_name"
)
strtext = "SELECT area_name.area_no, area_name.area_name, area_tel.area_tel, area_tel.area_fax, " &_
"area_address.area_add1,area_address.area_city, area_address.area_city, area_address.area_state, area_address.area_zip " &_
"FROM (area_address INNER JOIN area_name ON area_address.area_no = area_name.area_no) INNER JOIN " &_
"area_tel ON area_name.area_no = area_tel.area_no " &_
"where area_name.area_name like '*"&area_name&"*'"
This sql code doesn't work. But if I take out the * from the search criteria, it works but not as I expected. It only searches for an exact match. I want to be able to search for the string within the field.
Any help will be greatly appreciated.
area_name=trim(request.form("area_name"
strtext = "SELECT area_name.area_no, area_name.area_name, area_tel.area_tel, area_tel.area_fax, " &_
"area_address.area_add1,area_address.area_city, area_address.area_city, area_address.area_state, area_address.area_zip " &_
"FROM (area_address INNER JOIN area_name ON area_address.area_no = area_name.area_no) INNER JOIN " &_
"area_tel ON area_name.area_no = area_tel.area_no " &_
"where area_name.area_name like '*"&area_name&"*'"
This sql code doesn't work. But if I take out the * from the search criteria, it works but not as I expected. It only searches for an exact match. I want to be able to search for the string within the field.
Any help will be greatly appreciated.