© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
1 reply
Guns

C# Data Table issue

https://pastebin.com/DSHwSh0M

based on this program, I need to set the values of the
Old PS A11Y State
Old PS A11Y State
in the
mergedDataTable
mergedDataTable
to the values from the initial target file/worksheet and technically the
targetDataTable
targetDataTable
. what do i need to changed?

Rn this is how it is being done, but for unknown reasons, even after updating the file the values for that column (
Old PS A11Y State
Old PS A11Y State
) are not being updated;

foreach (DataRow targetRow in targetRows)
  {
    targetRow.SetField("Status", updatedStatus);
 
    DataRow updatedRow = syncedDataTable.NewRow();
    updatedRow["Finding ID"] = findingId;
    updatedRow["Status"] = updatedStatus;
    syncedDataTable.Rows.Add(updatedRow);
 
    DataRow mergedRow = mergedDataTable.NewRow();
    mergedRow["Finding ID"] = findingId;
    mergedRow["eA State"] = sourceDataTable.Rows[i].Field<string>("Status");
// assuming the issue is here;
    mergedRow["old PS A11Y State"] = targetDataTable.Rows[i].Field<string>("Status");
                        
    mergedRow["new PS A11Y State"] = updatedStatus;
    mergedDataTable.Rows.Add(mergedRow);
}
foreach (DataRow targetRow in targetRows)
  {
    targetRow.SetField("Status", updatedStatus);
 
    DataRow updatedRow = syncedDataTable.NewRow();
    updatedRow["Finding ID"] = findingId;
    updatedRow["Status"] = updatedStatus;
    syncedDataTable.Rows.Add(updatedRow);
 
    DataRow mergedRow = mergedDataTable.NewRow();
    mergedRow["Finding ID"] = findingId;
    mergedRow["eA State"] = sourceDataTable.Rows[i].Field<string>("Status");
// assuming the issue is here;
    mergedRow["old PS A11Y State"] = targetDataTable.Rows[i].Field<string>("Status");
                        
    mergedRow["new PS A11Y State"] = updatedStatus;
    mergedDataTable.Rows.Add(mergedRow);
}


e.g; on the fist run i.e when the file is not yet synced the data grid view should look like this;

v1;
finding id, ea state,old, new
1a, closed, open, closed
finding id, ea state,old, new
1a, closed, open, closed


then after updating the file and re opening the updated file, the data grid view should look like this;

v2;
finding id, ea state,old, new
1a, closed, **closed**, closed
finding id, ea state,old, new
1a, closed, **closed**, closed


but instead the datagrid view is still looking like the first version...
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Get Data from Table api c#
C#CC# / help
3y ago
Input issue c#
C#CC# / help
4y ago
Data types in C#
C#CC# / help
13mo ago
✅ C# Data structure selection
C#CC# / help
3y ago