DBF close problem

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
mlnr
Posts: 127
Joined: Fri Aug 28, 2015 1:52 pm
DBs Used: DBF

DBF close problem

Post by mlnr »

Hi you all,

I have a strange problem. There are open DBF files that sometimes close themselves. I cannot give an example code, because it happens randomly in different functions. In that case I get an error notification I log the open files, but it says there are no open DBF files.
Have anyone experienced something like this before? Any tips on how to handle it?
User avatar
salamandra
Posts: 311
Joined: Thu Jul 31, 2008 8:33 pm
DBs Used: DBF, MySQL, SQL
Location: Brazil

Re: DBF close problem

Post by salamandra »

Hi mlnr,
mlnr wrote: Mon Feb 01, 2021 7:37 pm Hi you all,

I have a strange problem. There are open DBF files that sometimes close themselves. I cannot give an example code, because it happens randomly in different functions. In that case I get an error notification I log the open files, but it says there are no open DBF files.
Have anyone experienced something like this before? Any tips on how to handle it?
If This problem it´s related always to the same DBF files probably you have an error in your program.
Can you post your code and the errorlog file ?? maybe we can help you.


Best regards,

Salamandra, Brazil
There is one time in which is crucial awakening. That time is now. ( Buddha )
mlnr
Posts: 127
Joined: Fri Aug 28, 2015 1:52 pm
DBs Used: DBF

Re: DBF close problem

Post by mlnr »

Hi Salamandra,

Thank you for your answer.
Unfortunately, there is no problem with the same DBF. Plus, not in the same part of the program. This is a great program with diverse parts. Sometimes I refer to a DBF's field in a simple list and since it is not open and I get an error message. But after that I use the same function many times and no problem. It only comes out very rarely, but always elsewhere. There is a way that all open DBF are closed in another function. It can also occur on different computers. I don't think there is an error in the program, maybe it could be a memory problem or something else (?)
edk
Posts: 998
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: DBF close problem

Post by edk »

Does this problem happen e.g. after calling the print preview, saving the printout to pdf/jpg, using functions such as GetFile, PutFile, GetFolder, etc.?
I had such an issue and it resulted from changing the current working folder after triggering the above events. From now on, just in case, after these operations, I return to the correct working folder by hb_CWD().
mlnr
Posts: 127
Joined: Fri Aug 28, 2015 1:52 pm
DBs Used: DBF

Re: DBF close problem

Post by mlnr »

Thank you Edward,

I use the dirchange() instead of hb_cwd(). But i will rewrite it to hb_cwd().
Although I did not change folders for these parts. However, what you wrote gave me an idea. I also write the path of the current folder to the error log. Maybe this will also help detect the error.
mlnr
Posts: 127
Joined: Fri Aug 28, 2015 1:52 pm
DBs Used: DBF

Re: DBF close problem

Post by mlnr »

I checked and the error log is created in the current job folder. So not sure that the folder change is the problem in my case. :(
movilceles
Posts: 20
Joined: Sun Dec 04, 2016 1:43 pm
DBs Used: DBF
Location: Murcia - España

Re: DBF close problem

Post by movilceles »

I have had similar problems in w10 when the disks go inactive, I don't know if this will be the case
------------------------------------------------
Translated with google
Celes
Saludos / Regards :P - :idea: Cuanto mas simple mejor !! / The simpler the better !!
franco
Posts: 877
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: DBF close problem

Post by franco »

I think like edk. I had a new user and all of a sudden I had program crashes. I found out she was printing to file from print preview. I had to blank out
the print to file on print preview window. For some reason, after picking a file name in another folder of c drive it did not come back to currentfolder.
A while back Serge suggested and I do the same is open the tables I want to use in all programs and close them when I leave that program. I use
modal windows mostly so this really saves getting lost by being able to go all over the place and not knowing where you came from.
All The Best,
Franco
Canada
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: DBF close problem

Post by AUGE_OHR »

hi,

how "fast" are you testing DBF :?:
are you working in Network :?:

as Edward say most it is Energe-Saving under Windows 10
but it is not "Disk" I/O ... it is the Network Card which goes "sleep"

---

i can close my Laptop and normal all is going "sleep"
but when my Xbase++ App is still running i do not want any Power-Saving when close Laptop


to disable Power-Saving i use this

Code: Select all

PROCEDURE MAIN()
   SetStandbyOFF(.T.)
   // run App
   SetStandbyOFF(.F.)
   QUIT
RETURN
this Code i use under Xbase++ using Ot4XB Syntax

Code: Select all

FUNCTION SetStandbyOFF(lOnOff)
LOCAL nRet := 0
DEFAULT lOnOff TO .F.

   IF lOnOff = .T.
      nRet := @KERNEL32:SetThreadExecutionState( nOr(ES_CONTINUOUS, ES_SYSTEM_REQUIRED,ES_DISPLAY_REQUIRED ,ES_AWAYMODE_REQUIRED) )
   ELSE
      nRet := @KERNEL32:SetThreadExecutionState( ES_CONTINUOUS )
   ENDIF
RETURN nRet
see https://docs.microsoft.com/en-us/window ... utionstate
have fun
Jimmy
mlnr
Posts: 127
Joined: Fri Aug 28, 2015 1:52 pm
DBs Used: DBF

Re: DBF close problem

Post by mlnr »

Thank you very much for your help.
The comments were helpful, I will scan the program based on them and i will check the win10 settings.
Post Reply