Why the returned DataTable only has readonly columns in FileHelpers

I am wondering why filehelpers returns readonly columns.

I had a huge problem with not updating the values ​​and couldn't understand why. Now I have to have another loop to go through all the columns and change them to be inaccurate.

Is there a way I can tell Filehelpers not to do this? So I don’t need to waste time on all this?

+6
source share
1 answer

The FileHelpers method class RecordOperations.CreateEmptyDataTable() is responsible for this, and it is not virtual.

I think the reason may be that it looks like a regular DataReader via DataTable.Load(IReader) , which would also create readonly rows.

However, it is easy to fix by going through columns instead of rows:

 foreach (DataColumn col in dt.Columns) col.ReadOnly = false; 
+11
source

Source: https://habr.com/ru/post/908105/


All Articles