Concurrency and DataRowVersions

sfx

Well-known member
Joined
Jan 31, 2006
Messages
46
Programming Experience
Beginner
Hello All,

Does anyone have any suggestions (or examples) on how to go about iterating through a DataTable for only those DataRows that have a specific DataRowVersion and then copying them (and their values) into another DataTable?

I am wanting to create a conflict resolution screen for an app that I am working on, but can't seem to find an easy way to display concurrency conflict information through separate DataTables.

Cheers,

sfx
 
Hi cjard,

Thanks for your response. When iterating through rows do you know how to find the specific column(s) that contain the error?

Cheers,

sfx
 
You ask the datatable:

In the immediate window (upon getting a constraint exception or soemthing) i do something like this:

?MyDataSet.HasErrors
True

?MyDataSet.MyFirstTable.HasErrors
False

?MyDataSet.MySecondTable.HasErrors
True

?MyDataSet.MySecondTable.Rows(0).HasErrors
False
?MyDataSet.MySecondTable.Rows(1).HasErrors
False
?MyDataSet.MySecondTable.Rows(2).HasErrors
False
?MyDataSet.MySecondTable.Rows(3).HasErrors
True

?MyDataSet.MySecondTable.Rows(3).RowError
"ForeignKeyConstraint FirstTable_SecondTable requires the child key values (123456) to exist in the parent table."
 
To find specific columns in error would be something like:

Dim badRow as DataRow
badRow = some row that has a problem


VB.NET:
For Each dc as DataColumn in badRow.GetColumnsInError()
  MessageBox.Show(badRow.GetColumnError(dc.Ordinal))
Next dc

For more info see GetColumnsInError (gets an array of datacolumns but i dont think you can get the rror from the exact column)

GetColumnError (ask the DataRow what it thinks the error with the column is, using the Ordinal of the datacolumn from the collection gained above)
 
Back
Top