Information générale
Catégorie:
Visual FoxPro Beta
>
>Thank you for your insight, I was able to find a solution using BeforeCursorUpdate. Don't you find it a bit odd, though, that changes done in BeforeUpdate are respected if the data source is "ADO", but not when it is "Native"?
>
Hi Eyvind,
If Agnes is correct and the field you are trying to modify hasn't been marked as modified before, the auto-generated command doesn't include the field because the command is generated before the BeforeUpdate event is called. I am sure, you would see the same result for ODBC and even ADO data source type if CursorAdapter were configured to send updates through ADODB.Command object. However, when CursorAdapter is configured to send updates through ADODB.Recordset, the command is not generated. In this case, after the BeforeUpdate event, CursorAdapter goes through modified fields and simply puts their values into the recordset, that is why your changes are picked up. To achieve the same result with other scenarios, you may try to change cUpdateInsertCmd parameter of the BeforeUpdate event or change UpdateType for the CursorAdapter, which has its own side-effects. Moving logic to the BeforeCursorUpdate event might be not what you really want because it is called only when TABLEUPDATE is called explicitly, it is called once per TABLEUPDATE call not once per record, it is called regardless of what type of changes you have buffered Updates/Inserts/Deletes or whether there are changes at all.
Thanks,
Aleksey.
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement