PC Review


Reply
Thread Tools Rate Thread

Add new row and get duplicated ?

 
 
Matej Kavčič
Guest
Posts: n/a
 
      10th Jun 2005
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;

}


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Duplicated Messages Diva Dee Microsoft Outlook Discussion 1 13th Feb 2009 04:54 PM
Duplicated DLL's Ozvideo Windows XP Help 2 8th Jul 2005 01:49 AM
duplicated mail =?Utf-8?B?RGlhbmU=?= Microsoft Outlook Discussion 6 18th Jun 2005 04:15 PM
All E-mails Duplicated Kim Odell Microsoft Outlook Discussion 1 6th Nov 2004 01:43 AM
Duplicated value Chai Microsoft Access Form Coding 1 20th May 2004 08:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:09 AM.