Hi,
I ned to dump data from a grid to a dataset to update a new DB, I have created the dataset, The problem I am having is getting the data from the grid Can anyone explain how I can dump the grid into my dataset?
Thanks,
George
Hi,
I ned to dump data from a grid to a dataset to update a new DB, I have created the dataset, The problem I am having is getting the data from the grid Can anyone explain how I can dump the grid into my dataset?
Thanks,
George
Know the answer? Post it. Somebody with the same question will find it here.
Bechir BejaouiRank #144 · 15.9K pointsPosted Nov 15, 2008, 7:45 AM EST
Bechir BejaouiRank #144 · 15.9K pointsPosted Nov 15, 2008, 1:37 PM EST
datagridVew.datasource = yourdataset;
datagridview.datamember = dataset.tables[0].TableName;
Normally, the datagridview and your data set are tied, am I miss understand you?
George Laing37 pointsPosted Nov 15, 2008, 1:55 PM EST
Hi,
In this case the datagrid was filled by a xml file, I want to put the changes from the grid to a new dataset. I can't seem to get the grid to load a new dataset.
Thanks
Bechir BejaouiRank #144 · 15.9K pointsPosted Nov 16, 2008, 4:17 AM EST
you do use an unbound datagrid to fill a data table
George Laing37 pointsPosted Nov 16, 2008, 4:50 AM EST
Hi,
The datagrid does have a datsoource but the member field is empty.
Thanks
Bechir BejaouiRank #144 · 15.9K pointsPosted Nov 16, 2008, 2:32 PM EST
datatable dt = ds.tables.add(...)
then you have to dimension the data grid
for(int i =0;i<dt.columns.count;i++)
{
datagridview1.columns.add("column" + i.tostring(),"column" + i.tostring());
}
for(int i =0;i<dt.Rows.count;i++)
{
datagridview1.Rows.add();
}
once the datagridview is dimensioned
then you create double boucle that assign each value entred in the datagridview to the data table
dt[index][index]<-- datagridview[index,index].value
1 short reply
George Laing37 pointsPosted Nov 15, 2008, 1:09 PM EST