Solved

read data from dbf file

Posted on 2014-03-20
6
437 Views
Last Modified: 2014-04-06
Hi Experts
I have been having problem where files are left open and on shutdown it corrupts the file.
is there a way to open c connection  to dbf table and read the data like in .net   So that as soon as you read the data you can close the connection?

thanks
0
Comment
Question by:b001
  • 3
  • 2
6 Comments
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 39942080
.NET does not really connect and disconnect from DBFs, it's just working through either ODBC Driver or OLEDB PRovider and these do the usual native access of DBF files as you do in VFP. Just because you have to open a connection with an OLEDB connection string or a DSN in .NET doesn't make DBFs connected or disconnected and working with a server, this is just the ODBC/OLEDB nomenclature.

Bye, Olaf.
0
 

Author Comment

by:b001
ID: 39943574
HI Olaf
What I am trying to achieve  is that no table is left in use in case there is power cut and the files get corrupted. Please advice what is the best way to stop getting files corrupted.
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 39943663
-USV to prevent power outages, so you only need to deal with users shutting down windows.
-ON SHUTDOWN rect with not allowing Windows to shutdown
-Turn off oplocks (turn off smb2 protocol to be able to turn off oplocks)
-Not using DBFs at all
-....

It's very unlikely you get corruptions just because windows shuts down. You have to write during the shutdown to corrupt files. File corruptions only occur at writing. In case of power outages nothing happens to a file just because it is open.

Bye, Olaf.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 41

Expert Comment

by:pcelba
ID: 39943921
Olaf is correct. The DBF file cannot become corrupted without writing to it. If this really happens to you then you should look at your hardware reliability.

OK, let suppose you are writing to the DBF file from .NET

To minimize the damage possibility you have to close the connection or the file whenever it is not used. You may also execute the FLUSH or FLUSH FORCE command which writes all changes to the disk so the failure or user stupidity cannot corrupt data in buffers.

You should disclose how do you access DBF files then we may tell more.

BTW, DBF files on our server accessed by several hundred users every day were not corrupted for years. The point is the stable environment and no direct network access to DBFs. Interesting is the fact data are not damaged even when we kill all instances accessing them... The reason could be VFP transactions which are minimizing the disk access.
0
 

Author Comment

by:b001
ID: 39944725
I have not had this problem for a long time. It has happened twice in last 2 weeks only on one machine that is running windows8 and it corrupted the same table. Could there be an reason for this to happen?
0
 
LVL 29

Accepted Solution

by:
Olaf Doschke earned 500 total points
ID: 39945280
Sounds like the oplocks problem.

Apply this to the Win8 client:
http://www.alaska-software.com/fixes/smb2/overview.shtm#download

Good Luck.

Bye, Olaf.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now