xsharp.eu • Empty DBF and EOF
Page 1 of 1

Empty DBF and EOF

Posted: Fri Mar 26, 2021 7:30 am
by Horst
Hello
I create a DBF and later i have this code

db:gotop()
do while ! db:eof
dbf:fieldget (xy) -> crash

the Prg crashed when the DBF has NO records.
I think, eof shoud be true when the dbf is empty or not ?
For now i fixed it with if db:reccount > 0

Horst

Empty DBF and EOF

Posted: Fri Mar 26, 2021 8:45 am
by Chris
Hi Horst,

This should work fine, I also just created a small test and I do not get the error.
CAn you please send a small compilable sample showing this problem?

Empty DBF and EOF

Posted: Fri Mar 26, 2021 11:09 am
by Horst
Hi Chris

I was checking now the dbf. In VO, the dbcreate made dbf files i coud not open with dbAdmin. Size 611 calculated 610. Append on this files was allways no problem , thats why i did not care.
I moved my app in february to x# and it looks like this was a old tempfile created with CAVO.
So i hope this problem is solved in x#

Thanks Horst

Empty DBF and EOF

Posted: Fri Mar 26, 2021 2:54 pm
by Chris
Hi Horst,

I am sorry, I did not understand what you mean, can you please explain a bit more?
Do you mean there is still a problem, or is it fixed now? If you still get a problem, can you tell me exactly what I need to do, in order to reproduce it?

Empty DBF and EOF

Posted: Fri Mar 26, 2021 3:09 pm
by Horst
Hi Chris

I think , there is no problem in x#. Think x# creates the better files :-)
Because i dont see strange empty dbf files like VO created it. The dbf file in the zip was created by VO.
I will observe it.

Thanks Horst

Empty DBF and EOF

Posted: Fri Mar 26, 2021 3:49 pm
by Chris
Hi Horst,

Ah, thanks, OK I understand now! I tried your code also in VO though, and it also creates the file correctly from what I see. Maybe the dbf you posted was not created by VO, but from another tool..

Empty DBF and EOF

Posted: Fri Mar 26, 2021 4:13 pm
by Horst
Hi Chris

Its from VO. Maybe its a bug in 2.7 . I did not upgrade to 2.8

Horst

Empty DBF and EOF

Posted: Fri Mar 26, 2021 4:21 pm
by Chris
Hi Horst,

Oh you are right! I just tried with VO27 and indeed I get the same problem!
And it is very strange, because I also had not moved my own VO app to 2.8 and had never seen this problem before. Really strange..

Empty DBF and EOF

Posted: Fri Mar 26, 2021 4:54 pm
by Horst
Hi Chris

I think normaly you will create a file and then you fill it 99.9999%. The append is working normal.

In my case, there is a situation i dont fill the dbf and then later on i try to read. Then booom.

Horst

Empty DBF and EOF

Posted: Fri Mar 26, 2021 5:59 pm
by Chris
Hi Horst,

Ah indeed, after an Append it all works fine in VO 2.7 also.