Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道为什么文件助手返回只读列。
我有一个很大的问题,他们没有更新值并且无法弄清楚为什么。现在我必须有另一个循环来遍历所有列并将它们更改为非只读的。
有没有办法告诉 Filehelpers 不要这样做?所以我不必再浪费时间经历这一切了吗?
FileHelpers 类RecordOperations.CreateEmptyDataTable()方法对此负责,它不是虚拟的。
RecordOperations.CreateEmptyDataTable()
我认为原因可能是它类似于使用普通的DataReader通过DataTable.Load(IReader)也会创建只读行。
DataReader
DataTable.Load(IReader)
但是,很容易通过遍历列而不是行来修复:
foreach (DataColumn col in dt.Columns) col.ReadOnly = false;