Page 1 of 2
CToD() new incompatibility to VO
Posted: Mon Jun 19, 2023 10:52 am
by Horst
Hello
I think there is still a problem, i had to go back to 2.14 because i had an error on this
Code: Select all
SELF:odbSina:LockCurrentRecord ()
SELF:odbSina:FIELDPUT (#DatePrint, DToC (Today())+NTrim (Seconds()))
SELF:odbSina:Unlock ()
the error msg was
bei XSharp.RT.Functions.DefError(Object oErr)
bei XSharp.RT.Functions.<>c.b__84_0(__Usual oError)
bei <>f__AnonymousType1.Eval(__Usual[] Xs$Args)
bei XSharp.RT.Functions.Eval(ICodeblock block, __Usual[] args)
bei XSharp.RT.Functions.Eval(__Usual uCodeBlock, __Usual[] args)
bei VO.DbServer.Error(__Usual[] Xs$Args)
bei VO.DbServer.FIELDPUT(__Usual[] Xs$Args)
i am not on my working computer so i cant say more at the moment. but before there was no problem.
Horst
CToD() new incompatibility to VO
Posted: Mon Jun 19, 2023 11:20 am
by wriedmann
Hi Horst,
the problem described on this thread was about to CToD(), not DToC().
How is your DatePrint field defined?
Wolfgang
CToD() new incompatibility to VO
Posted: Mon Jun 19, 2023 11:50 am
by robert
Horst,
What is the datatype of the field #DatePrint. I assume it is a string?
What is the size of this field ?
What is the Date Format ?
Is it possible that the result of the expression :"DToC (Today())+NTrim (Seconds())" produces a value that is larger than the size of that field ?
Robert
DToC() new incompatibility to VO
Posted: Mon Jun 19, 2023 11:51 am
by Horst
Hello Wolfgang
Its string, the msg says also i have to lock the record.
As i said , i am not on my pc . so i cant say anything at this time. maybe its a lock problem. but runs perfect before i compiled with 2.16
Horst
DToC() new incompatibility to VO
Posted: Mon Jun 19, 2023 12:26 pm
by wriedmann
Hi Horst,
maybe the record is locked by another process, so it cannot be locked by your current process.
Normally, you should always check the return value LockCurrentRecord():
Code: Select all
if oServer:LockCurrentRecord()
oServer:FieldPut( "xxx", yyy" )
oServer:Commit()
oServer:Unlock()
else
// Error handling - record cannot be locked
endif
Wolfgang
DToC() new incompatibility to VO
Posted: Mon Jun 19, 2023 2:58 pm
by Horst
Hello Robert and Wolfgang
I will check that this week. When i have access to my pc
Horst
DToC() new incompatibility to VO
Posted: Mon Jun 19, 2023 2:59 pm
by Chris
Hi Horst,
In addition to what others said, is the problem always reproducible, does it happen always when you run the app? If yes, then temporarily please remove the Seconds() part where you create the new text to see if the problem still happens. Then add back the seconds() part and remove the DToC() part, then even try to fieldput an empty string. This will tell us if the problem has to do with one of the functions, if it is related to the total length of the string, or it is a completely different problem.
CToD() new incompatibility to VO
Posted: Tue Jun 20, 2023 4:32 pm
by Horst
Hello
It's not the DtoC Function, something with the locking.
On my localhost comes no error, only on the internet server machine.
At the moment i have no time to analyse that.
Horst
CToD() new incompatibility to VO
Posted: Wed Jun 21, 2023 3:45 am
by wriedmann
Hi Horst,
in the code you have posted there was no "unlock()" call.
Please make sure that you always release your locks.
Wolfgang
CToD() new incompatibility to VO
Posted: Wed Jun 21, 2023 8:30 am
by Chris
Wolfgang, there does exist an Unlock() in the code, in the last line. But indeed there's no check if the locking failed, as you pointed out.
Horst, can you please check if your call to LockCurrentRecord() returns false indeed? If it does, can you please set in XIDE in the menu Debug->Handled Exceptions->Break Always, then start the app in debug mode and see if you get a runtime exception in that call to LockCurrentRecord()? If yes, can you please post the full error message shown?