Reputation: 17196
I'm writing code to emulate a unit of work pattern in my winforms over datasets application.
I have the following:
foreach (EomApp1.Formss.Accounting.Data.AccountingView.AccountingViewRow
in accountingView.GetChanges(DataRowState.Modified).Tables[0].Rows)
{
// break point -> immediate window
immediate window:
modified.Tables[0].Rows[0]["Cost/Unit", DataRowVersion.Original]
1
modified.Tables[0].Rows[0]["Cost/Unit", DataRowVersion.Current]
0
Is there any way to access the above information using strongly typed datasets? (in my example, accountingView is, but I don't know how to get at the changed DataRowVersion objects without using the string names of the columns.
Upvotes: 2
Views: 4495
Reputation: 16858
Does the DataRowExtensions.Field extension method in System.Data.DataSetExtensions
assembly solve this for you? Note parameters for DataColumn
and DataRowVersion
.
Upvotes: 1
Reputation: 3094
as far as I know there is none.
To get rid of the magic strings you could do
modified.Tables[0].Rows[0][Tables[0].CostUnitColumn.ColumnName, DataRowVersion.Current]
Upvotes: 3