nnmm

nnmm

  • NA
  • 325
  • 0

TimeStamp and EntityFramework in Visual Studio 2010

Oct 8 2013 2:34 AM
I am using Timestamp in visual Studio 2010 and Entity Frame work. the Application is in single mode( because I am programming it- Nobody else is working with it).
The first time I Edit a Record , the result would be Successful. but for the second time that i want to edit that record , it fails this is the error message
"Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries."
I traced the program. when i am reading the object

ListViewItem item = new ListViewItem(cableApplication.Id.ToString());
item.SubItems.Add(cableApplication.Application);
 item.SubItems.Add(cableApplication.DefaultSize.ToString());
 item.SubItems.Add(ASCIIEncoding.ASCII.GetString(cableApplication.tstamp));
 listView1.Items.Add(item);
i watch the value of the cableApplication.tstampin watch window,
it is byte[8] :0,0,0,0,0,0,18,178
again in the watch window i convert tstamp into string and then byte[], the value of tstamp changes
Encoding.ASCII.GetBytes(ASCIIEncoding.ASCII.GetString(cableApplication.ts)) it gives me :0,0,0,0,0,0,18,63
so definately i'll get the error message  because the value of tstamp has changed 

but for the first time that i edit the record but value are equal , so it is possible to edit the record,

any help is appreciated about time stamp
thank you

Answers (3)