I have some code which first i create datarow object of same dataset type.
Tahn i fill some data in this row. And than add row to dataset and then
update and accep changes. Ockey. There is a problem when i first click
button which do code above. I get new row, ockey no problem, when i click
second time it is also ockey. i edit some data in grid and the click again
add buton whic do code above. Now I get third row but the second row is now
automaticly overwriten, now have the same values like third. What cooud be
problem. I Use Visual studio 2003, Windows Form,
dsBatch.AttributeRow dro = dsBatch1.Attribute.NewAttributeRow();
dro.IDAttributeValueType=1;
dro.Name="test";
dsBatch1.Attribute.Rows.Add(dro);
Attribute.Update(dsBatch1.Attribute);
dsBatch1.Attribute.AcceptChanges();
and ther is completly code
private void bitmapButton2_Click_1(object sender, System.EventArgs e)
{
gridControl1.BindingContext[dsBatch1.Attribute].EndCurrentEdit();
dsBatch.AttributeRow dro = dsBatch1.Attribute.NewAttributeRow();
if (tl.FocusedNode.Level==0)
{
dro.IDProcessCellType=Convert.ToInt32(tl.FocusedNode.Tag);
if (rbIn.Checked==true) dro.AttributeType=700;
else dro.AttributeType=800;
}
if (tl.FocusedNode.Level==1)
{
dro.IDProcessUnitType=Convert.ToInt32(tl.FocusedNode.Tag);
if (rbIn.Checked==true) dro.AttributeType=200;
else dro.AttributeType=300;
}
if (tl.FocusedNode.Level==3)
{
dro.IDEquipmentModuleType=Convert.ToInt32(tl.FocusedNode.Tag);
if (rbIn.Checked==true) dro.AttributeType=500;
else dro.AttributeType=600;
}
dro.IDAttributeValueType=4;
dro.IDEngineeringUnit=8;
dro.Order=dbFunction.MaxID("Attribute","order");
dsBatch1.Attribute.Rows.Add(dro);
DM.qAttribute.Update(dsBatch1.Attribute);
dsBatch1.Attribute.AcceptChanges();
gridView1.FocusedRowHandle=gridView1.RowCount-1;
}
|