ReadOnly Exception Error when Inserting with an Expression Column

  • Thread starter Thread starter Mike Tavares
  • Start date Start date
M

Mike Tavares

Hi,

I have am getting the following exception when I try to update my strongly
typed dataset back to the database:

Cannot change ReadOnly property for the expression column

This error occurs when the following conditions are met:

1. The datatable contains an identity field
2. The datatable contains an expression column
3. A new row has been inserted into the datatable
4. The insert command text contains a Select Scope_Identity() statement
after the insert

This error will not occur when I am just updating a row. I think it has
something to do with the retrieving the value from the identity field, but
am not positive.

Does anyone know of a work-around for this bug?

Thanks,
Mike
 
Hi Mike,

I think it has to do with expression columns (insertcommand tries to update
all columns)
Try removing them befure update and re-add them after.
 
Back
Top