If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Pervasive.SQL > Btrieve API Tutorial

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-06-04, 10:57
kam_ex kam_ex is offline
Registered User
 
Join Date: May 2004
Posts: 5
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
Reply With Quote
  #2 (permalink)  
Old 05-06-04, 14:21
mirtheil mirtheil is offline
Registered User
 
Join Date: Dec 2001
Posts: 1,026
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.
Reply With Quote
  #3 (permalink)  
Old 05-06-04, 17:44
kam_ex kam_ex is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 05-06-04, 21:13
mirtheil mirtheil is offline
Registered User
 
Join Date: Dec 2001
Posts: 1,026
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.
Reply With Quote
  #5 (permalink)  
Old 05-07-04, 05:20
kam_ex kam_ex is offline
Registered User
 
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
Reply With Quote
  #6 (permalink)  
Old 05-07-04, 08:07
mirtheil mirtheil is offline
Registered User
 
Join Date: Dec 2001
Posts: 1,026
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.
Reply With Quote
  #7 (permalink)  
Old 05-07-04, 13:07
kam_ex kam_ex is offline
Registered User
 
Join Date: May 2004
Posts: 5
k thx for all the help mirtheil!!!
ure da man^^
cheers
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On