R
rhaazy
Using C# and winforms.datagrid control
I have a datagrid that is bound to a dataset and the binding is done
like this:
connection1_admin.Open();
SqlCommand myCommand1 = new SqlCommand("select OrgSystemID, OrgSystem,
OrgSystemDescr from tblOrgsystem",connection1_admin);
adapter1_admin=new SqlDataAdapter();
adapter1_admin.SelectCommand = myCommand1;
ds1_admin = new DataSet("tblOrgsystem");
adapter1_admin.Fill(ds1_admin, "tblOrgsystem");
dg1_admin.SetDataBinding(ds1_admin, "tblOrgsystem");
SizeDataGridColumnsToContent(dg1_admin, -1);
connection1_admin.Closed();
When the user makes changes to the datagrid, shouldn't the dataset
reflect these changes?
frmEditOrgSystem frmEditOrgSystem = new frmEditOrgSystem();
DataGridCell currCell;
currCell = dg1_admin.CurrentCell;
int RowNumber = dg1_admin.CurrentRowIndex;
dg1_admin[RowNumber,1] = str_editsystem1;
dg1_admin[RowNumber,2] = str_editsystem2;
However when I do ds1_admin.HasChanges() I get nothing until.....
I click on a different row of the datagrid, then it finds the changes.
Does anyone have any idea what I'm doing wrong????
I have a datagrid that is bound to a dataset and the binding is done
like this:
connection1_admin.Open();
SqlCommand myCommand1 = new SqlCommand("select OrgSystemID, OrgSystem,
OrgSystemDescr from tblOrgsystem",connection1_admin);
adapter1_admin=new SqlDataAdapter();
adapter1_admin.SelectCommand = myCommand1;
ds1_admin = new DataSet("tblOrgsystem");
adapter1_admin.Fill(ds1_admin, "tblOrgsystem");
dg1_admin.SetDataBinding(ds1_admin, "tblOrgsystem");
SizeDataGridColumnsToContent(dg1_admin, -1);
connection1_admin.Closed();
When the user makes changes to the datagrid, shouldn't the dataset
reflect these changes?
frmEditOrgSystem frmEditOrgSystem = new frmEditOrgSystem();
DataGridCell currCell;
currCell = dg1_admin.CurrentCell;
int RowNumber = dg1_admin.CurrentRowIndex;
dg1_admin[RowNumber,1] = str_editsystem1;
dg1_admin[RowNumber,2] = str_editsystem2;
However when I do ds1_admin.HasChanges() I get nothing until.....
I click on a different row of the datagrid, then it finds the changes.
Does anyone have any idea what I'm doing wrong????