Neven Draskovic

Neven Draskovic

  • NA
  • 117
  • 139.9k

Filtering mechanisms

Feb 8 2012 10:19 AM
I have to implement a filter mechanism that will query a database and return the results to a .rdlc report that displays it in a report viewer. I managed to make it work for single condition queries (by using TableAdapters), but the problem is with multiple conditions. I managed to make a method that generates the appropriate query based on which checkBoxes the user has checked (I displayed it in textBox4 so I know it is correct), but I don't know how to change the appropriate TableAdapters (that fill the datasets used to fill the report). I tried with:

KontrolorRadTableAdapter.Adapter.SelectCommand = new SqlCommand(textBox4.Text);
KontrolorRadTableAdapter.Fill(princMarpromTestDataSet.KontrolorRad);
reportViewer1.RefreshReport();
reportViewer1.Refresh();
But when I click the button that contains this code, nothing happens.
Do you have any ideas how to fix this? The only alternative, I can think of, is to make a TableAdapter query for every possible combination of conditions (there are 5 of them) but that is not practical, so can you suggest a more elegant solution?
Thanks

Answers (2)