Reputation: 2982
According to MSDN, it's possible to get the original version for a single column in a DataRow
. However, this requires either using the column index or column name. This is a strongly-type dataset and I don't want to get into the maintainability nightmare of using magic column index numbers or string literals to specify which column I need.
Is there any way to get the entire strongly-typed row? Or, if that is not possible, is there a way to get a single strongly-typed column using a strongly-typed referenced?
Upvotes: 2
Views: 1870
Reputation: 31
Example of single strongly-typed column using a strongly-typed reference:
// DataTable...
SkZapDataSet.vdSkZapDocumentDataTable dt
= args.Row.Table as vdSkZapDocumentDataTable;
// DataRow...
SkZapDataSet.vdSkZapDocumentRow dr
= args.Row as SkZapDataSet.vdSkZapDocumentRow;
// Value...
int id = (int)dr[dt.DocumentIdColumn.ColumnName, DataRowVersion.Original];
Upvotes: 3
Reputation: 11025
I am afraid you will likely strike out across the board here. The difference between the Original
and Modified
RowVersion only exists until AcceptChanges()
is called...a finite period. And the Columns
collection at its heart is an ArrayList
, with these accessors:
public DataColumn this[int index] { get; }
public DataColumn this[string name] { get; }
I don't see how you'd find a DataColumn
any other way.
Upvotes: 1