c# - Remove DataTable From DataSet doesn't work -
i have problem "undeletable" datatable.
step 1: create datatable
datatable dt = dtprogpoints_template.clone(); //create table dt.tablename = "program points 0"; //rename dsprogpoints.tables.add(dt); //add dataset dsprogpoints.acceptchanges(); //i found in forum, tried
step 2: display in datagridview
dtgprogpoints.datasource = dsprogpoints; //dtgprogpoints datagridview dtgprogpoints.datamember = "program points 0";
step 3: remove datatable
dsprogpoints.tables.remove("program points 0"); //remove datatable dataset ds.acceptchanges();//i found in forum, tried
and now, mystery coming.
if check dsprogpoints.tables.count;
, table removed, number of tables smaller before removing.
when try delete again, exception occurs.
but when try dtgprogpoints.datamember = "program points 0";
, data displayed in datagridview. table still not member of table collection in dataset, because if try read dsprogpoints.tables["program points 0"].rows[0][0]
exception fired, because table "program points 0" not member of table collection.
when create again using dsprogpoints.tables.add("program points 0");
table created. means, not exist in dataset
it looks there problem datagridview
? tahnk you, pavel
Comments
Post a Comment