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.
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.
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
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
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.