Single row delete causes concurrency error via datagridview

Simply one row deleted from datagridview.

In the UserDeletedRow event we:
called endedit on the bindingsource for the grid and then call the
tableadapter.update on the dataset. The update method is when the
concurrency error happens.

Totally confused. This couldn't be a simpler example. One table with a
few columns with a single deleted row.

Ideas?
0
Glenn
2/19/2010 9:09:20 PM
dotnet.languages.csharp 1931 articles. 0 followers. Follow

7 Replies
1049 Views

Similar Articles

[PageSpeed] 42

Hello,

Optimistic concurrency is checked by selecting the row using the original 
values in the where clause. If one of the values stored in the DB is 
truncated because of a precision problem, the where clause won't return the 
original row resulting in a concurrency error.

Which DB are you using With SQL Server just use the profiler to see the 
delete statement and play with the where clause to find out which criteria 
make the query to fail (starting with dates). You may want also to do the 
same thing programmatically without using the datagridview. It would allow 
to find out if the datagridview have something to do with the issue (IMO 
not)...

--
Patrice

"Glenn Welker" <gwelker@gmail.com> a �crit dans le message de 
news:58335e74-5ca5-4d02-a03b-37f4af3b4415@o16g2000vbf.googlegroups.com...
> Simply one row deleted from datagridview.
>
> In the UserDeletedRow event we:
> called endedit on the bindingsource for the grid and then call the
> tableadapter.update on the dataset. The update method is when the
> concurrency error happens.
>
> Totally confused. This couldn't be a simpler example. One table with a
> few columns with a single deleted row.
>
> Ideas? 

0
Patrice
2/20/2010 9:45:20 AM
"Patrice" <http://scribe-en.blogspot.com/> wrote in message 
news:upRupFhsKHA.3408@TK2MSFTNGP06.phx.gbl...
> Hello,
>
> Optimistic concurrency is checked by selecting the row using the original 
> values in the where clause. If one of the values stored in the DB is 
> truncated because of a precision problem, the where clause won't return 
> the original row resulting in a concurrency error.
>
> Which DB are you using With SQL Server just use the profiler to see the 
> delete statement and play with the where clause to find out which criteria 
> make the query to fail (starting with dates). You may want also to do the 
> same thing programmatically without using the datagridview. It would allow 
> to find out if the datagridview have something to do with the issue (IMO 
> not)...
>
> --
> Patrice
>
> "Glenn Welker" <gwelker@gmail.com> a �crit dans le message de 
> news:58335e74-5ca5-4d02-a03b-37f4af3b4415@o16g2000vbf.googlegroups.com...
>> Simply one row deleted from datagridview.
>>
>> In the UserDeletedRow event we:
>> called endedit on the bindingsource for the grid and then call the
>> tableadapter.update on the dataset. The update method is when the
>> concurrency error happens.
>>
>> Totally confused. This couldn't be a simpler example. One table with a
>> few columns with a single deleted row.
>>
>> Ideas?
>
Rather than using compare all, use a datestamp.
Update the time when you update.
If someone else updated it since you read the data then you can tell because 
the datestamp will be different.
Add Last_Updated_user Id as a colummn as well and you can also tell the user 
who changed their data. 

0
Andy
2/20/2010 10:12:44 AM
> Rather than using compare all, use a datestamp.
> Update the time when you update.
> If someone else updated it since you read the data then you can tell 
> because the datestamp will be different.
> Add Last_Updated_user Id as a colummn as well and you can also tell the 
> user who changed their data.

Good point Andy, forgot to mention this as I focused on finding first if 
this is the issue.

Glenn, if this is the issue and you are using SQL Server you can use the 
rowversion datatype. The value is automatically updated when you insert or 
update a row and is then use automatically to check for concurrency so you 
have nothing to change to benefit from this beyond adding this column.
--
Patrice


0
Patrice
2/20/2010 10:24:59 AM
On Feb 20, 5:24=A0am, "Patrice" <http://scribe-en.blogspot.com/> wrote:
> > Rather than using compare all, use a datestamp.
> > Update the time when you update.
> > If someone else updated it since you read the data then you can tell
> > because the datestamp will be different.
> > Add Last_Updated_user Id as a colummn as well and you can also tell the
> > user who changed their data.
>
> Good point Andy, forgot to mention this as I focused on finding first if
> this is the issue.
>
> Glenn, if this is the issue and you are using SQL Server you can use the
> rowversion datatype. The value is automatically updated when you insert o=
r
> update a row and is then use automatically to check for concurrency so yo=
u
> have nothing to change to benefit from this beyond adding this column.
> --
> Patrice

Thanks guys,

I am using SQLite and this app only runs in a single user scenario. It
appears that the grid is doing something to one of my column values.
Haven't got it completely narrowed down, but I am guessing that it is
probably my date column. Once I stripped my 9 columns back to 2 it
works without errors.

Thanks again
0
Glenn
2/20/2010 12:43:07 PM
> I am using SQLite and this app only runs in a single user scenario. It
> appears that the grid is doing something to one of my column values.
> Haven't got it completely narrowed down, but I am guessing that it is
> probably my date column. Once I stripped my 9 columns back to 2 it
> works without errors.

Ok then you could dump the Dataset to see differences between the new values 
and the original values. It should reveal what value unexpectedly changed 
because of a possible precision problem

Also a quick look at http://www.sqlite.org/datatype3.html made me think it 
could be some kind of dynamic typing issue (something such as reading a 3.2 
value being stored back later as a "3,2" (due to country convention) string 
as SQLite seems to be able to dynamically type each value).

--
Patrice


0
Patrice
2/20/2010 1:20:14 PM
On Feb 20, 8:20=A0am, "Patrice" <http://scribe-en.blogspot.com/> wrote:
> > I am using SQLite and this app only runs in a single user scenario. It
> > appears that the grid is doing something to one of my column values.
> > Haven't got it completely narrowed down, but I am guessing that it is
> > probably my date column. Once I stripped my 9 columns back to 2 it
> > works without errors.
>
> Ok then you could dump the Dataset to see differences between the new val=
ues
> and the original values. It should reveal what value unexpectedly changed
> because of a possible precision problem
>
> Also a quick look athttp://www.sqlite.org/datatype3.htmlmade me think it
> could be some kind of dynamic typing issue (something such as reading a 3=
..2
> value being stored back later as a "3,2" (due to country convention) stri=
ng
> as SQLite seems to be able to dynamically type each value).
>
> --
> Patrice

It is my datetime value but I'm not sure why it would change. The
datagridview doesn't display it so I don't think it is the problem.
The dataset must have a modified value when it is being read from the
database.

You mentioned dumping the dataset. How do I go about this?
0
Glenn
2/20/2010 3:31:18 PM
On Feb 20, 10:31=A0am, Glenn Welker <gwel...@gmail.com> wrote:
> On Feb 20, 8:20=A0am, "Patrice" <http://scribe-en.blogspot.com/> wrote:
>
>
>
> > > I am using SQLite and this app only runs in a single user scenario. I=
t
> > > appears that the grid is doing something to one of my column values.
> > > Haven't got it completely narrowed down, but I am guessing that it is
> > > probably my date column. Once I stripped my 9 columns back to 2 it
> > > works without errors.
>
> > Ok then you could dump the Dataset to see differences between the new v=
alues
> > and the original values. It should reveal what value unexpectedly chang=
ed
> > because of a possible precision problem
>
> > Also a quick look athttp://www.sqlite.org/datatype3.htmlmademe think it
> > could be some kind of dynamic typing issue (something such as reading a=
 3.2
> > value being stored back later as a "3,2" (due to country convention) st=
ring
> > as SQLite seems to be able to dynamically type each value).
>
> > --
> > Patrice
>
> It is my datetime value but I'm not sure why it would change. The
> datagridview doesn't display it so I don't think it is the problem.
> The dataset must have a modified value when it is being read from the
> database.
>
> You mentioned dumping the dataset. How do I go about this?

Here is the code I used for the dump.
            foreach (DataTable table in joeDataSet1.Tables)
            {
                System.Diagnostics.Debug.WriteLine("TABLE " +
table.TableName.ToString() + "");
                foreach (DataRow row in table.Rows)
                {
                    foreach (DataColumn column in table.Columns)
                    {
                        if (row.RowState =3D=3D DataRowState.Deleted)
                        {
                            System.Diagnostics.Debug.WriteLine("Column
<strong>" + column.ToString() + "</strong> =3D " + row[column,
DataRowVersion.Original].ToString() + "");
                        }
                        else
                        {
                            //
System.Diagnostics.Debug.WriteLine("Column <strong>" +
column.ToString() + "</strong> =3D " + row[column].ToString() + "");
                        }
                    }
                }
            }

The curious thing is the SQLite doesn't actually have a datetime data
type. This was news to me. However the System.Data.SQLite does
implement one.
0
Glenn
2/20/2010 4:15:19 PM
Reply:

Similar Artilces:

Save a single worksheet in Excel as a single file.
I have multipe worksheets in a single workbook. I would like to be able to save each worksheet individually. I want to send each worksheet to an individual, I do not want to send the entire workbook. All information must be retained in the one workbook, but as the individual worksheets are updated, the individual worksheet needs to be saved and sent to that individual. Help anyone? Thanks. Linda you can probably find the answer here. http://www.rondebruin.nl/ -- Don Guillett SalesAid Software dguillett1@austin.rr.com "Dakota" <Dakota@discussions.microsoft.com&...

Returning Multiple Values in a Single Cell
Hello, I posted this same question a couple of weeks ago but forgot to mention a key point. My question was as follows: I have read a few posts regarding this subject but am still somewhat lost. I have a two sheet workbook (Excel 2000). On the first sheet is a list of projects that my department will complete during the year. A description of each project is given, a start date, an end date, as well as which crew will be completing the work (Crew 1 or Crew 2). What I am trying to do on the second sheet is to be able to type in any date, and have the description of the project on that da...

Delete control?
I'm using VB in VS2003.NET. I have a TabControl with a couple of group boxes. I've added some buttons and labels to a group box, but now I want to delete the controls. Cannot! Why? I've tried pressing "Delete", right-clicking but Cut and Delete are disabled. I can't even delete the whole group box. What am I missing here??? Is this some strange setting locking down group boxes on a TabControl or mabe a bug in VS2003.NET? Thanks, Alain Ok, solved the problem. It must be an initialisation problem in VS 2003.NET. If I close VS and then reopen, I...

send rows of excel sheet to text file
I want to input data into cells in a spreadsheet and then send or save the data to a txt file without any delimiters. ie go from excel columns ABC 123 T456 to ABC123T456 Each row would need to be a new line in the text file Any ideas Thanks Chris Chris, Use the Text Write Program at www.tushar-mehta.com. Select your cells, and use the selection option. Leave the delimiter box blank. -- Earl Kiosterud mvpearl omitthisword at verizon period net ------------------------------------------- "Chris" <chris.nospam@nospam.atlas-anchor.com> wrote in message news:Ot0cb....

Can the computer be set to randomly select a row for a drawing?
I will be entering in a whole list of names from various locations for a drawing. How can I ramdomly select a registered winner? lets say your list of names is in row A1:A100. You could type a formula in B1 that says =RANDBETWEEN(1,100) keep in mind that the result will change every time you open the file, press F9 and probably a few other circumstances. So, if you want to save the result, you'll need to copy/paste values over top of the formula after it picks the winner. "annie33" wrote: > I will be entering in a whole list of names from various locations for a &g...

How to apply a formula accross all the rows when the total rows are too much in no. ?
Hi, guyz i know you can drag the formula accross the rows in that column t have that formula in effect in every cell. but i have some data lik 5000 rows then how to get that formula accross each cell, its painfu holding the mouse and dragging the formula accross the rows. please advise thanks in advance sorab -- Message posted from http://www.ExcelForum.com Hi after inserting this formula in the first row double click on the lower right corner of your cell selection -- Regards Frank Kabel Frankfurt, Germany > Hi, > guyz i know you can drag the formula accross the rows in that col...

Pushing office updates via ARD
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel Is it possible to package (maybe using PackageMaker) the office 2008 updates and push them out 'silently' to our office users? And with that said, 'if' this were possible, does the office update forcefully quit all office programs when installing silently? Thanks. lordlala@officeformac.com wrote: > Is it possible to package (maybe using PackageMaker) the office 2008 > updates and push them out 'silently' to our office users? > > And with that said, 'if' this were possible,...

counting the number of equal rows
hi there, my problem is the following: i have a worksheet with about 8000 rows and 200 columns. i have to find out the row (that has 200 fields) which exists the most within the 8000. so i thought excel ought to take the first row e.g. and compare it to the second, the third and so on. after comparing the row with the last one there should be a counter saying that my "sample-row" is there xx times. then it should take the second row, compare it to the rest and so forth. is it possible to tell excel to do as described? plz excuse my really bad english, it's been a while... ;) ...

error 0x80040116 solved?
I created a new pst to solve error 0x80040116 (posted July 25.03) everything works fine but I cannot access old emails. Any ideas would be appreciated. Thanks in advance for any help. Before I created a new pst chkdsk/scandisk would not run. chkdsk-unusual error occurred scandisk-file not accessible Since the creation of my new pst, I can now access my old emails after I ran chkdsk/scandisk 5 times in succession. So far everything seems back to normal. >-----Original Message----- >I suspect that there is a disk error in one of the sectors used by your old >PST. I...

rpc-https on Single server
Hi, I am enabling rpc over https on single exchange server, which is also a DC and GC. After installing rpc proxy component on Windows Server 2003, I used ESM to enable rpc-http for Back-End server. Upon doing so, I got a dialog box complaining there is no Front-End server in my environment. However, the rpc-http for Back-End option is still selected. When I open outlook 2003 which is configured to use rpc-http, the connection status still use TCP/IP. I checked the rpcProxy ports in registry, all entries are defined correctly. Do I miss out any important steps or any websites I can refe...

Is there a way to control the height of a row via an excel function?
I'm trying to control the height of a row determined by the contents o a cell... I can't seem to find a function or command that is available to me t allow this. Alternatively, is there a way that I can 'hide' or 'unhide' a row base on a cell's contents? Best to you! Larry Seye -- Message posted from http://www.ExcelForum.com The only way I know of controling the height of a row is by using the Format/Row/Autofit, it might be possible uing VBA, try posting the question under programing see what answer you get. However, for the second part of your questio...

Hiding rows in a CListCtrl
Is there any way that you can change the row height of an individual row. I want to hide rows based on a filter but still use the control with owner data so I don't have to add and remove the items from the control. Any ideas? -- //*Eggbox You could use a virtual list control where you could determine what you want to display and when from the original data. You wouldn't be hiding rows, but you would have the ability to determine what data you display and when. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_Virtual_List_Controls.asp Tom &...

Delete E-Mails
I am unable to delete from my inbox. The only thing I can do is transfer them to the junk file, but I can't delete them from there either. I am running XP version 5.1 with service pack 3. I might also add that I'm a senior with limited computer savy, so if you can help please explain thing as detailed as possible. Any assistance would be greatly appreciated. Move most of your messages out of the Inbox and move any messages you want to save out of Deleted Items and Sent Items and then close OE. Tools | Options | Maintenance | Store Folder will reveal the location of you...

How Do I create a worksheet with rows and columns
I need help in creating a document with rows/ columns in Excell, I havice Microsoft Office 2003 Randy wrote: > I need help in creating a document with rows/ columns in Excell, I havice > Microsoft Office 2003 *EVERY* Excel workbook has "rows and columns" by default! What do you want to put in them? -- Interim Systems and Management Accounting Gordon Burgess-Parker Director www.gbpcomputing.co.uk airpage wrote: > I am trying to create a form, to print that contains the information, I am > new to this product > What "information"? I suggest you stop w...

duplicate error message
I actually have two questions: 1) Is there a way to duplicate a record without duplicating all of the fields? I have a button that I set up using the wizard that duplicates the record, but it also duplicates fields that I do not want to accept duplicates. So if I hit duplicate the record, it pops up with an error about the table not accepting duplicates for this field. Any good ideas? 2) I need a message box to pop up if someone inputs a duplicate unique id. I was trying to use this text on the Form_Unload property, but it keeps coming up with "syntax error missing operator on ...

Counting Rows by Month
Hi, I have a large table with ~2500 rows. One column contains date information (date of the creation of the record). I'd like to count how many records (rows) I have for each month. I tried with the countif() function, but I don't know how to express a date range in the criteria field. Thanks in advance for your help. Raph Hi One way =COUNTIF(A1:A2500,">=01/11/2005")-COUNTIF(A1:A2500,">30/11/2005") for the month of November Or if you want to put your start and end dates in separate cells so you can amend them, then with start date in D1 and end date in...

Error
Hi All, I have exported some data to Great Plains 7.0.After posting the transaction, I try to go to the Bank Deposits Screen and delete a deposit, it asks me "are you sure you want to delete this deposit?" i click yes, and it appears to delete it, but when i re-open the screen it is still there. any ideas? Thanks, Kunkel By pressing the Delete button you are deleteng the document that you are capturing, you not are deleting the deposit. What you must do is in the "Option" field choose "Enter/Edit" and in the "Type" field choose "Clear Unuse...

Indexing Server error on CRM
The following error appears after a reboot of CRM. Does CRM need Indexing Server running? Event Type: Error Event Source: Ci Event Category: CI Service Event ID: 4127 Date: 29/11/2007 Time: 6:42:16 PM User: N/A Computer: xxx Description: Content index on c:\inetpub\catalog.wci could not be initialized. Error 3221225477. CRM does not need indexing server to be running unless you use the online help ======================= John O'Donnell Microsoft Dynamics ISV Architect Evangelist http://blogs.msdn.com/usisvde "PeterB" <PeterB@discussions.microsoft.com> wrote ...

Copy Object = File Not Found Error
I'm working in XP and and developed a Database in Access 97. There was a push to upgrade. Now we're using Access 2003 and we converted the database to Access 2000. The new problem: I had developed some code to look for a Report by name and if it was not found, simply copy a specific Report and name it accordingly. This all worked fine in 97. In the new setup I receive an Microsoft Visual Basic error: File not found (Error 53). The path in the error message points to a temp folder and file called VBCxx.TMP. the x's change each time. If I go to that folder before I ex...

error message exiting outlook 2003
On exiting Outlook 2003, I get a message that says "The instruction at 0x7c910f2b referenced memory at 0x0bcd5c4c. The memory could not be read" Any ideas? -- ------------------------------------------------------------------------- FIGHT BACK AGAINST SPAM! Download Spam Inspector, the Award Winning Anti-Spam Filter http://mail.giantcompany.com Does this also happen when you disable your add-ins? What is logged to the Event Viewer regarding this? -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -What do the Outlook Icons Mean? -Create an Offic...

Single Site Single Org Multiple Domains Exchange 5.5
Help anyone.... I have an Exchange 5.5 Server on a AD Domain and an Exchange 5.5 Server on a NT 4 domain. All same site and same org. I have been able to install the Exchange on the AD domain and join it to the existing site and org on the NT domain. My issue is that it will not replicate with any of the Exchange servers on the NT domain. I have a 2 way trust and I have no issues going back and forth between the 2 domains to access shares or any other resources between the two domains. The errors that I am getting in the Event Log are of course 9318 and 9322. I have tried host and lmhos...

Ability to Make Customers/Cashiers Inactive (not deleting them)!
It would be great to be able to remove unwanted customers and cashiers from RMS without having to delete them. Consider this scenario: 1) You fire an employee so you want to delete their Cashier login...but you don't want to delete it because then you can't see all of their sales so you can't investigate any more for theft. 2) You also want to make sure the employee can't recieve their employee discount so you want to delete them from the Global Customer list...but if you do then you lose all of their purchase history! Yes, i know that there's ways around this like...

Outlook 2007 Calendar appointments disappearing without being deleted
Hi, I have a user who is using outlook 2007 client and his mailbox is on exchange 2007 server. User has 3 monitors and opens calendar in separate window on one of these monitors, the calendar view is a weekly one and multiple times through out the day some appointments on his calendar disappear except for the recurring ones. User has blackberry and still see=92s appointments there and if he closes the calendar window then reopens it, the appointments are back. Has anyone experienced this issue before? And any help/suggestions is much appreciated I'd start with the /cleanviewsswi...

Exchange NDR "Error is [0x80004005-00000000-00000000]."
Interesting NDR sent to a user today. No known issues - no corresponding events that I have discerned in the event log. No quota on this user. No issues with database are known. Single user, single event. The user sends email to at least one of these addresses several dozen times a day. Previous emails to both addresses independently are successful and without evidence or indication of a problem. I am reviewing other logs in further detail, early indications are that this is a one-time event. Anyone have any idea what direction to look in order to get more information on this problem? ...

Hide Rows #3
Is there a quick way to hide every other row starting at row 12? I.E. hide rows 12, 14, 16, 18 and so on. Thanks, Steve Hold down the control key>select by row number>hide or write a macro to hide (use MOD) -- Don Guillett SalesAid Software donaldb@281.com "Steve" <sgauer@neo.rr.com.nospamallowed> wrote in message news:4D85C6E0-F7BF-4728-8354-93FB28DF9A18@microsoft.com... > Is there a quick way to hide every other row starting at row 12? I.E. hide > rows 12, 14, 16, 18 and so on. > > Thanks, > Steve Steve wrote: > Is there a quick way to hide ev...