How to use Search query for my database?
I want to create a search engine for my website.
-i have a textbox for the user to search from my database records.
- And a Search Button.
In the search button click event , i have a connection string for the Database.
-I just want to know how to relate the search textbox with the sql query i created in connection string.
eg:'
Stringvariable=Textbox1.text;
//open the connection
DbCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT F.PredictId, F.PredictionTopic, F.Memlgname, F.MemPrediction, F.UknowY, F.Memvote, C.MemComments, C.CommUserName FROM Forumtable AS F LEFT OUTER JOIN CommentTable AS C ON F.PredictId = C.PredictId WHERE F.MemPrediction Like '%' ORDER BY F.PredictId asc ";
-My question is i want to refer the textbox1 in the place of "Like '%' ".
-how can i do that. Please help.
|