C
CJ Taylor
Alright, So this morning (as we are a week from launch on our product) I
come across an error as I add a simple thing to our system. A display
column in our dataset for databinding for display purposes only.
So everything goes smoothly, compile, start running, everything looking
good. then I go to update a row.. get a System.Data.Readonly exception.
I investigate further to find this is a known bug in the framework according
to many articles. Here is one if you want to read about it some..
http://www.error-bank.com/[email protected]_Thread.aspx
So, I read the "workarounds" which are lame attempts to trick the framework
by removing expression columns from the datatable before the update, and
then add them back after the update.
Now to me... this sounds really dumb...
So I tried something. I attached to the RowUpdated and RowUpdating events
of my DataAdapter. Rowupdating provides nothing useful. However Row
Updated comes back with the Sql.Data.ReadonlyException
This sets the Status property of the
System.Data.SqlClient.SqlRowUpdatedEventArgs
to ErrorsOccured. However, I check the database and my fields were updated
as excpected. It's just the fact it can't change the Readonly property on
the expression column...
I don't care about that...
So I set the Status to continue if the error is of Data.ReadonlyException
No problems...
I return to the UI Layer... No problems... all changes updated as
expceted....
is there anything obvious I'm missing in this? Why this wouldn't work?
Comments appreciated.
Thanks,
CJ
come across an error as I add a simple thing to our system. A display
column in our dataset for databinding for display purposes only.
So everything goes smoothly, compile, start running, everything looking
good. then I go to update a row.. get a System.Data.Readonly exception.
I investigate further to find this is a known bug in the framework according
to many articles. Here is one if you want to read about it some..
http://www.error-bank.com/[email protected]_Thread.aspx
So, I read the "workarounds" which are lame attempts to trick the framework
by removing expression columns from the datatable before the update, and
then add them back after the update.
Now to me... this sounds really dumb...
So I tried something. I attached to the RowUpdated and RowUpdating events
of my DataAdapter. Rowupdating provides nothing useful. However Row
Updated comes back with the Sql.Data.ReadonlyException
This sets the Status property of the
System.Data.SqlClient.SqlRowUpdatedEventArgs
to ErrorsOccured. However, I check the database and my fields were updated
as excpected. It's just the fact it can't change the Readonly property on
the expression column...
I don't care about that...
So I set the Status to continue if the error is of Data.ReadonlyException
No problems...
I return to the UI Layer... No problems... all changes updated as
expceted....
is there anything obvious I'm missing in this? Why this wouldn't work?
Comments appreciated.
Thanks,
CJ