Have anyone faced this issue where data field turns read only and when we try to update the value, it throws the exception.
Exception has been thrown by the target of an invocation.| System.Data.ReadOnlyException: Column ‘RequestType’ is read only.
at System.Data.DataRow.set_Item(DataColumn column, Object value)
at System.Data.DataRow.set_Item(String columnName, Object value)
This happens when I do SQL query and save result to datatable. I am not fetching any value for the column from database, just using some random string to fill the field:
select [Shipment], ‘empty’ as [Column1]
from Table1
I can assing values to [Shipment], but to to [Column1], as it is read only.
An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ----> System.Data.ReadOnlyException: Column ‘Column1’ is read only.
at System.Data.DataRow.set_Item(DataColumn column, Object value)
at System.Data.DataRow.set_Item(String columnName, Object value)
How do You get such a robust error description? - i got only “Exception has been thrown by the target of an invocation.” and wasted a day looking for a solution (which is very hard to find) until i finally stumbled upon Your thread