VB 2010 - lock/unlock DBF files via BDE (part 2)


I need to set lock on DBF (dBase) table via BDE API in Visual Basic 2010. Similar like Delphi procedure:

TTable.LockTable(LockType: TLockType);

My questions are:

1. Should I open the table before locking and get its handle? If yes, how can I open the table via BDE API?

2. What happens on HDD, when lock is set? (the attribute od file DBF is set to read only, or BDE creates some temporary file as lock, or BDE writes somewhere the information, that this table is locked)

Who is Participating?
Sinisa VukConnect With a Mentor Commented:
some way agree with Geert_Gruwez but can help you more...

1. Yes, handle of table is needed for locking.
not vb but can help too....
I rather go with odbc api or ado - not bde

2. I really don't use dbase but locking is working, with ado you can specify locking too...
Geert GOracle dbaCommented:
the flaw with dbase is that anyone with access to the files can just delete them

move the data to a real database, like mssql, oracle, interbase, ...
bde is deprecated, it's over 10 years now

you'll loose a day or 2 converting to another database
but you'll find it's worth every bit of that time
you wouldn't have to recreate the indexes every week ...

dbase isn't really multiuser, the bde just mimicks it in a very good way
skdanAuthor Commented:
I agree, but currently I am creating an application, which will use the same data (dbf files) like other older application created in Delphi. Users are using that older application in network. I can't change it.
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Geert GOracle dbaCommented:
it's probably easier to rewrite the whole thing and then add your extra functionality ?

how hard can it be to convince management to renew the app for which there doesn't seem to be anybody around anymore to support it ?

if you have the delphi sources, find an (external) delphi dev to extend it (and convert to new db)
skdanAuthor Commented:
That Delphi application is older, but still in use, with support, upgrades and so on. My application adds some funcionality, which Delphi programers don't plan to add to their application. They created the new system with SQL server, but it will take some time, when all users move to new version. But I agree, this is the future, of course.
skdanAuthor Commented:
It's a good idea to try it with ado. I will try it. Thank you very much.
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.

All Courses

From novice to tech pro — start learning today.