Hi All-
I am relatively new to winforms and C# and I am developing an application that will allow users to perform a search. To search the data they can use the following:
-Combobox with 6 options
-text box that they will enter info based on the combobox search selected.
I have a stored procedure with a parameter for each of the search options. The procedure works for searching on any of the options. This procedure has been added to the project and I am connecting to it via a TableAdapter.
What I am struggling with is the best way to pass each of these search criteria to the code. I started it this way:
public void DataRefresh(string searchCombo, string searchValue)
{
string returnMessage = string.Empty;
switch (searchCombo)
{
case "Acct":
Data.Manager.TAM.SearchDataTableAdapter.Fill(DataSet.spSearchData, ref returnMessage, searchValue, null, null, null, null, null);
break;
}
SearchDataBindingSource.DataSource = DataSet.spSearchData;
}
I was initially thinking I could use the switch/case to pass the parameters based on what has been sent by the user.
Is there a better way to do this? I am thinking yes, but I can't seem to think of a way.
Any suggestions would be great!