Results 1 to 7 of 7
  1. #1
    Join Date
    May 2004
    Posts
    5

    Unanswered: Btrieve API Tutorial

    hihi
    ive been using the OLE DB for quite some time now in Vb6 and Pervasive.
    I want to use Btrieve API calls (or atleast attempt). I have a few examples and such which explains most of the functions and know hows etc.

    I am though looking for more info bout Btrieve API calls from Vb6... mostly i'm looking for a tutorial that explains the example Code and syntax used. I did look at the (API Programmer's Reference from Pervasive.com) but its still a little confusing etc.

    thx in advance
    cheerz

  2. #2
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    Is there anything specific that is confusing? I don't know of a good tutorial but I've been using the Btrieve API for 8+ years now..
    Mirtheil Software
    Certified Pervasive Developer
    Certified Pervasive Technician
    Custom Btrieve/VB development
    http://www.mirtheil.com
    I do not answer questions by email. Please post on the forum.

  3. #3
    Join Date
    May 2004
    Posts
    5
    hey thx for replying

    I really dont know where to start..
    What is needed to start a VB project from scratch and to make that project do API calls to pervasive?
    Can I just add another Module and start coding my api functions and structures in there or do i need Source modules or something of that kind I am unaware of?

    The Structure of my Mod if i should start to code now would be something like this.

    'Delcaring Consts for API Functions that will be needed in my Status Command line that will execute the API Call (there's quite a few)
    ex. const BOPEN = 0
    const BINSERT = 2

    'Then i would declare the Function i will be using to access the "w3btrv7.dll" file which in turn will access the specified record in Pervasive

    ex. Declare Function BTRCALL Lib "w3btrv7.dll" (ByVal OP, ByVal Pb$, Db As Any, DL As Integer, Kb As Any, ByVal Kl, ByVal Kn) As Integer

    'Then i would declare UDT, my fields and their Type

    'After that i would assign values to those fields and then execute (if i'm inserting) and then use BTRCALL function to do the API call.

    I just wanna know if i'm on the right track and how much still needs to be done and reviewed. Can u maybe just tell me what Functions/structures i'm missing and why i need them etc.

    sorry for the long read!
    keep well

  4. #4
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    THat looks good so far. For some more samples, you might check out:
    http://www.pervasive.com/developerzo...isualbasic.asp
    THere's two good samples there. One's called "Btrieve Visual Basic Updater" and the other is "Btrieve and VB 6".
    Mirtheil Software
    Certified Pervasive Developer
    Certified Pervasive Technician
    Custom Btrieve/VB development
    http://www.mirtheil.com
    I do not answer questions by email. Please post on the forum.

  5. #5
    Join Date
    May 2004
    Posts
    5
    thx mirtheil
    That Updater Sample explained alot. I stepped through the code and i understand most of it.

    I managed to do a Open on one of my DB tables and read every record (6412 records and omw it was fast :P)
    Although i'm curious, how would the BTRCALL look like if wanted to do a select on 1 record (a WHERE Clause). Is there even a function available for that or do i have to loop through every record and compare it to my condition?

    1 more question
    Is the Max record length that can be retrieved 255? Coz i noticed in the example the variable thats declared to hold the record is defined Space$(255).
    My record though is -+ 1900 in length which means i have to call only certain fields of the record at a given time, how would i do that? :P

    keep well

  6. #6
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    Answers to your two questions:
    1. You would issue a Get Equal operation. It uses a Key Number to specify which index is used for searching and will find one record that matches. If that index allows duplicates, then you, as the developer, will need to read through the records using a GetNext and check the return Key Buffer to make sure it still matches.
    2. I think you were looking at the KeyBuffer. The data buffer, which is where the record is stored on Get/Step/Insert/Update/Delete operations, can handle the 1900+ record length without problem. If memory serves, the DataBuffer can be 64,000 long. The Key
    Mirtheil Software
    Certified Pervasive Developer
    Certified Pervasive Technician
    Custom Btrieve/VB development
    http://www.mirtheil.com
    I do not answer questions by email. Please post on the forum.

  7. #7
    Join Date
    May 2004
    Posts
    5
    k thx for all the help mirtheil!!!
    ure da man^^
    cheers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •