I am trying to make an application that sorts a database with user input and returns a form. This form then accepts some user input, and then needs to be sorted in another event. I am using ado.net, and am attempting to complete this task by cloning a dataset and using select commands on the cloned dataset. This is the basic outline of how I'm trying to do this currently

public DataSet ds;

1 st button click event
{
initialize variable, set to input values...

oledbcommand cmd = new oledbcommand("SELECT * FROM TBL, database");
da.selectcommand = cmd;
oledbcommandbuilder cb = new oledbcommandbuilder(da);
ds = new dataset();
da.fill(ds);
datagridview.datasource = ds.tables[0];
}

this part works fine.

2nd button click event
{
dataset form = new dataset();
form = ds.Clone();
datatable dt = form.tables[0];
dt.select("FieldName > 0");
datagridview.datasource = dt;
}

This part returns a blank table in the same schema as the above table.

So in conclusion, I need to query a dataset from my database, and then I need to use the sort/compute commands on this data from another event.

I hate myself, cloned datasets are only supposed to retain table structure. If anyone is interested in similar uses, simply swap the work Copy in the place of Clone and your data will also be available in addition to table structure.

This question has already been answered. Start a new discussion instead.