What is the best approach for managing concurrency problems in C# .NET database applications? Any rules of thumb I should know about?
Generally, if you're going to perform operations on multiple databases/servers, you must use Enterprise Services (i.e., your classes inheriting from ServicedComponent). If you're working against a single database, try using manual transactions, or some approach like the one in CodeProject, and using optimistic concurrency whenever you can. The traditional way of doing this is retrieving timestamps for the rows you're using, and then comparing these timestamps with the current ones on the database. If they don't match, someone else's modified it, and you usually show the user both the actual values and his proposed changes, and let him chose which ones should prevail.
Dig Deeper on C# programming language
Related Q&A from Daniel Cazzulino
Here our experts address how to converti a VB Windows application to a VB .NET Web application. Continue Reading