PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Problem with HModify?
Problem with HModify?
Iniciado por guest, 09,nov. 2015 08:22 - 5 respuestas
Publicado el 09,noviembre 2015 - 08:22
There is a simple code (working in separate thread):

HReadSeekFirst(Events,EventID,CurrentEvent.EventID) IF HFound() THEN Events.isSent = True HModify(Events) END
Database errors are automatically handled. The error has been occured:

Record modification. The record was modified since the last read operation.
Does anyone has expierence with similar thing?
Publicado el 09,noviembre 2015 - 08:46
Hi,

1 - in oder to get more details, I'd write

IF NOT HModify(Events) THEN
Error(... , HErrorInfo(ErrorFullDetails) )
END

2 - this message makes sense for a multi-user program in order to signal that between reading and modifying a modification from another client in the network occured. Means, if this is the case, its a definite case for implementing a transaction in order to keep others from modifying the Event-records.

3 - If it is a single-user program then a) the databas could need a restructure or reindex. b) Look into the HFSQL Control Center whether all of the links to / from the Event file are correct and there are no duplicates. You can correct a wrong situation in the HFSQL Control Center.
Publicado el 09,noviembre 2015 - 10:06
Quote
GuenterP

1 - in oder to get more details, I'd write
As I wrote above the automatic error handling is used and the error message is enough informative :)

The program is a single user and only one user had access to HFSQL file and the error as I understand occured between HReadSeekFirst and HModify.
I've tried to use re-indexing as you have suggested. Thank you. Will see for results.
Publicado el 09,noviembre 2015 - 12:54
Hi,

Do you have any Triggers defined on the database?
Publicado el 09,noviembre 2015 - 13:37
HReadSeekFirst and HModify are in the same thread?
Publicado el 10,noviembre 2015 - 08:40
No triggers and both statements are in the same thread. I think maybe some ocasional HFSQL server problem.

P.S. I changed the couple of operators HReadSeekFirst/HModify to HExecuteQuery("UPDATE ...") with transaction flag. Hope it helps.