Good day
I'm using a xamDataGrid to update and add a few records. I'm using a ObjectDataProvider that calls a function in a bll. I have RecordAdding, RecordUpdating and RecordUpdated events to handle my own updating a business rules and so on.
For some reason when creating a new record it goes into the Adding event when you enter the data for the first time, then when all the data is entered, and you want to commit the record, it goes into the Updating event, and when it leaves it, it gives me an "Unable to update record" error, which does not tell me much... It does not even go into the Updated event, where I update my record myself in my own bll.
How can I get past this error? I want to handle these errors myself.
Kind regards
Christo
Hello Christo,
The RecordAdding event fires when a new object is created. This object is created right after you type the first character in any of the add record cells (the parameterless constructor is called). This record, however is not committed. The RecordUpdated event does not fire, because it is supposed to fire after the record has been updated correctly. In your case, you are getting an error and the update is cancelled.
Can you please give us more information on why the record cannot be updated?
Hi Alex
I seem to have resolved the problem. When I did a select for the data table, I selected more fields than are actually filled in on the front end because I'm doing a join on some data and then updating it using a sp.
It seems like some of the fields that was in the original select were key fields (that I fill in using the sp when doing a new insert) and those kind of constrains are embedded into the dt. It looks like the grid does not update because of the fact that some fields are still missing.
I would still like some more control over the updating function. If I cast my data table from my dataset adapter to a generic data table, this might solve the problem right? (Kinda thinking out load here) Casting to DataTable might just remove some of the constraints on the dt.