Improve company productivity with a Business Account.Sign Up


read data from dbf file

Posted on 2014-03-20
Medium Priority
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?

Question by:b001
  • 3
  • 2
LVL 31

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.

Author Comment

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.
LVL 31

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.
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

LVL 44

Expert Comment

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.

Author Comment

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?
LVL 31

Accepted Solution

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

Apply this to the Win8 client:

Good Luck.

Bye, Olaf.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: (http://msd…
If you are looking for an automated tool which can generate reports for Outlook emails and other items from PST file, then you can go for Kernel PST Reporter tool. The reports which are created by this tool are helpful to analyze and understand PST …
Watch the working video to know how to import Outlook PST/OST files to Amazon WorkMail. Kernel released this tool which is very easy to use and migrate single or multiple PST and OST files to Amazon WorkMail. To know more about Kernel Import PST to …

579 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