DataSet Row Locking


Randy L.

We are using a typed dataset in a singleton type scenario that is not bound
to a database. With multiple clients modifying the dataset we have
implemented a simple DataRow locking approach. The goal here is to insure
thread safety on tranactions in the dataset.

For example:

if( CurrentDataRow.RowState == DataRowState.Unchanged)

Is there a better appraoch to this? Is this enough info to get the gist of
the problem?

Randy L.



Kevin Yu [MSFT]

Hi Randy,

Are you using CurrentDataRow.RowState == DataRowState.Unchanged to ensure
the row is not being operated by other threads? In my opinion, this is not
reliable, because after the the if statement, this row still might be
changed. In this case, I suggest you try to use lock statement in C# to
lock the whole DataRow object.


Please check the following links for more information:


Kevin Yu
"This posting is provided "AS IS" with no warranties, and confers no

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

dataset record locking 0
Adding a row to a dataset 2
Update rows in dataset 1
Filter rows in a DataSet 5
Number of rows in dataset 4
Row Status Dataset 4
Deleting rows in dataset 1
Addign a row to a dataset 8