How to create a search bar and retrieve info from database

kirine

New member
Joined
May 30, 2006
Messages
1
Programming Experience
Beginner
I'm currenly try to create a search function by using ADO.NET and able to retrieve data from database. I'm not sure how to go about? Does anybody kind to help? thank you.
 
Create a search string that gets data from a textbox

Dim SQL as string
SQL = "SELECT * FROM your_table_name WHERE aCondition = '" & textbox.text & "'"

Or to be more flexible, try this...

SQL = "SELECT * FROM your_table_name WHERE aCondition LIKE '%" & textbox.text &"%'"

The syntax will vary depending on your database. You would then use the SQLClient or OLEDBClient commands for executing the SQL string.
 
Back
Top