Click to See Complete Forum and Search --> : search function


Navi
10-01-2007, 11:24 PM
Expert, I want to build a form with a drop down list with a textbox. When user select one from the drop down list and type a keyword, it will retrieve some info from the database. Any reference? Appreciate it!

lotuzwine
10-02-2007, 08:37 AM
try searching for Datagrids. Its quite easy to bind Data to a DataGrid, making it a mirror of your Database table. Seek for "DataGrid" and "DataGrid DataBinding". Then you will use the info you retrived from your inputs (dropdown and textbox) to send them as parameters to your sql query.

Something like this (C#):


string sqlQuery = "select [something] from [table] where [field] = @param";
sqlCommand.Parameters.Add("@param", myTxtBox.Text);
.
.
.
DataReader oDr = sqlCommand.ExecuteQuery(sqlQuery);
myDataGrid.DataSource = oDr;
myDataGrid.Databind();


I seldom use DataGrids so you will have to google it for more info.