title: C# example of ROWLOCK on SQL Server 2008?
body: <p>I have a SQL Server 2008 database that contains a table of Items. Many users are viewing Items and can choose at any time to check out an available Item. I want to have a simple locking scheme where the user clicks an Item, the server then acquires a ROWLOCK, checks if the item is checked out already (reads the row), checks it out if available (updates the row), and then frees up the lock.</p>
  
  <p>I have not been able to find any code examples showing how to do this completely. Most examples focus on a single statement, not multiple statements.</p>