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

Hi,

I would like to find solution for locking and unlocking dBase III and dBase IV tables (DBF files) from Visual Basic 2010 via BDE v5.01 (Borland Database Engine). I know, this is an old technology, but in this moment I need it for working with the same data like one older application created in Delphi.

I tried to lock tables via ADO, but this did not disable writing to the table for Delphi application, thats why I would like to try to lock tables with the same way, like Delphi application does, via BDE.

Now I know, that I need to use BDE API, but I don't know how exactly.

Until now I have these declarations:

    Private Declare Function DbiOpenDatabase Lib "IDAPI32.DLL" _
        Alias "DbiOpenDatabase" (ByVal lngDBName As Long,
                                 ByVal lngDBType As Long,
                                 ByVal intOpenMode As Integer,
                                 ByVal intShareMode As Integer,
                                 ByVal strPassword As String,
                                 ByVal intOptFlds As Integer,
                                 ByVal lngOptFldDesc As Long,
                                 ByVal lngOptParams As Long,
                                 ByRef lngDBHandle As Long) _
                                 As Integer


    Private Declare Function DbiOpenTable Lib "IDAPI32.DLL" _
        Alias "DbiOpenTable" (ByVal lngDBHandle As Long,
                              ByVal strTableName As String,
                              ByVal strDriverType As String,
                              ByVal strIndexName As String,
                              ByVal strIndexTagName As String,
                              ByVal intIndexId As Integer,
                              ByVal intOpenMode As Integer,
                              ByVal intShareMode As Integer,
                              ByVal intXltMode As Integer,
                              ByVal bytUniDirectional As Byte,
                              ByVal lngOptParams As Long,
                              ByRef lngCursor As Long) _
                              As Integer

Open in new window


But I don't know the values of parameters.

I don't know also, what code I need to put in Button1_Click, when I want to open database, open table, lock table and then for Button2_Click unlock table, close table, close database.

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        ' open database

        ' open table

        ' lock table
    End Sub

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        ' unlock table

        ' close table

        ' close database
    End Sub

Open in new window


Thanks
skdanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sinisa VukSoftware architectCommented:
maybe is this zip helpful if you able to get it (with registration on forum)
http://www.xtremevbtalk.com/showthread.php?t=237729

You want to lock tabale only or write into table too?

http://codenewsfast.com/cnf/article/0/permalink.art-ng1234q13950

maybe is solution to make delphi dll (internally use bde) and export some custom functions to vb.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
skdanAuthor Commented:
I know, my question is difficult because BDE is an older technology, and also there is not easy to find a programmer, who uses combination VB.NET and BDE.

I downloaded that zip file from your first link few days ago. It is very interesting, but written in VB 6, not VB.NET. Maybe I need some documentation for BDE for better understanding its API. Thank you for second link, I will look at it.

I also think, that I will need some part of code writen in Delphi. I will see.

Anyway thank you very much for your effort.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.