I'm working on a project that requires searching of a record in a database table. This is to be done using SQL, "select * from table where criteria = (user_input)". Is this possible, or are there any alternatives?
Printable View
I'm working on a project that requires searching of a record in a database table. This is to be done using SQL, "select * from table where criteria = (user_input)". Is this possible, or are there any alternatives?
Lynn,
"Select *..... Where user input" is a good method to use.
Only thing is - be careful while making the SQL string. The "'" sign should be used where you search for string, you can use the * and like keywords if want to search the string within a string.
I just give a small example
Lets us say in text1 control user typed the word "san". Now you wish to search the word in a string field called Xname then the search will be
mySql = "Select * from mydb where Xname like *" & trim(text1.text) & "*'"
'to find the exact text
mySql = "Select * from mydb where Xname = '" & trim(text1.text) & "'"
regards,
Santulan