VB 2010 - lock/unlock DBF files via BDE

Posted on 2013-10-08
Medium Priority
Last Modified: 2013-10-09

I use one older application, which was possibly created in Delphi and uses DBF files for storing data (DBase III and DBase IV). This application uses BDE v5.01 (Borland Database Engine) for access to DBF files.

I am creating VB.NET application and I need to write some records to these DBF files. This is not a problem for me, but there is the recommendation, that before writing is necessary to lock access for other users from Delphi application. This Delphi application uses BDE functions DbiAcqTableLock and DbiRelTableLock for these purposes.

My question is:

Is it possible in Visual Basic 2010 to lock and unlock DBF files (tables) similar like Delphi application does (via BDE, using functions DbiAcqTableLock and DbiRelTableLock)?

I would like to do it, because my application will work with DBF files at the same time with Delphi application.

Question by:skdan
  • 2
  • 2
LVL 28

Assisted Solution

by:Sinisa Vuk
Sinisa Vuk earned 2000 total points
ID: 39556722
Use these functions i a way how other windows api functions in .net word (pinvoke):

UInt16 DbiRelTableLock(IntPtr, LongBool, DBILockType)

UInt16 DbiAcqTableLock(IntPtr, DBILockType)

Open in new window


Author Comment

ID: 39558152
Thank you for reply. I don't know exactly the values of parameters. Can I use for example this:



Open in new window

LVL 28

Accepted Solution

Sinisa Vuk earned 2000 total points
ID: 39558461
sorry, not in VB but shoud be understandable...
function SetTableLock(datasetHndl: THandle; bLock: Boolean): Integer;
    if bLock then
        Result := DbiAcqTableLock(datasetHndl, dbiWRITELOCK)  // lock
        Result := DbiRelTableLock(datasetHndl, True, dbiWRITELOCK); // release

Open in new window

values of DBILockType:
dbiNOLOCK = 0                            { No lock   (Default) }
dbiWRITELOCK = 1                       { Write lock }
dbiREADLOCK =2                         { Read lock }

Open in new window


Author Comment

ID: 39558732
I have to study more things about it, but I believe, that your informations will help me to find solution. Thank you very much.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
An ASP.NET Web Form User Control is not newly introduced in ASP.NET. In fact, it was an old technology yet still playing a role to generate web content, especially when we want to use it to have a better and easy way to control part of the web conte…
In the video, one can understand the process of resizing images in single or bulk. Kernel Bulk Image Resizer is an easy to use tool for resizing large number of images. One can add and resize multiple images with this tool in single go. The video sh…
Through the video, you can check the migration process of Outlook PST file to PDF. Kernel for Outlook to PDF tool can convert Outlook emails with all attributes like Subject, To, From, Cc, Bcc and other folders such as Inbox, Outbox, Sent Items, Jun…

621 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