When you create a bound datagridview on a form you will see that doing that
creates three objects a dataset a binding source and a table adatapter. In
the binding source you will find a property called filter. This is basically
where you can enter a value that is everything you would find in a where
clause except the Where keyword
In your code you can write a sequence that does the following
1- clears the dataset or maybe just the datatable you want to use
2- Sets the filter on the bindingsource
3- Fill the tabledapter(s)
Lets say you have dataset1, that would give you Bindingsource1 and
datatable1 and your sql table itself is named Table1
You would do something like
dataset1.clear 'This clears all the data from all the rows in the dataset
If you want to be able to refill just a single table one at a time, you can
set the tableadapter's ClearBeforeFill property to true.
When you do that each time you call for a fill on a tableadapter it will
automatically clear that table adapter's content.
BindingSource1.filter = "Myfield1 = 'a string' and Myfield2 = 2"
TableAdapter1.fill(dataset1.table1)
You can put this in the form load event (in which case you don't need the
dataset1.clear statement) or you can do this in any event like a button
click. I spoke about the datagridview but basically any bound control on
your form will need to use the same three objects, dataset bindingsource and
table adapter.
HTH
Bob
"Altman" <ba*****@easy-automation.com> wrote in message
news:11**********************@c74g2000cwc.googlegr oups.com...
I am playing around with making a dataset with the designer in vb.net
2005. I realize you can add parameters to select statement and then
filter off of those parameters. What I would like to do is to take the
dataset that the designer made and add the whole where clause to it at
run time. Is this possible?