Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

read data from dbf file

Posted on 2014-03-20
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 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.

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 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.
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

LVL 42

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 29

Accepted Solution

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

Apply this to the Win8 client:

Good Luck.

Bye, Olaf.

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
get combo value in class 5 14
run a stored procedure from vb.net 1 27
Get month and date in a format 4 31
VB.net Open video relating to control 2 19
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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

860 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