INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

btrieve with vb6

btrieve with vb6

(OP)
hi, it's my first post here, i hope i'll get what i'm looking for.
well, i'm developing a vb6 application that need to connect a btrieve database.
it's an old version of btrieve.
after 1000s of searches over the net, and after that i found alot of examples i didn't find what i need.
all the example show me how to connect data base where a pervasive client is installed. as the btrieve version is old, it's not working with a client.
the major application is a magic develop application that manage the database and i need to cennect to the data base.
i prefer that the solution wont use ddf file. but i would like also to know how to connect a ddf file!
thanks

RE: btrieve with vb6

What version of Btrieve are you using?  
It is possible to access Btrieve files without the DDFs but you'll need to know the exact record structure.  

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
http://www.mirtheil.com

RE: btrieve with vb6

(OP)
the btrieve version is 6.5
i know the structure of the database and all the fields and tables names.
i will so thankfull if you give me an example for how to do that!

RE: btrieve with vb6

Here's the declare for VB6 and Btrieve 6.15:

CODE

Declare Function BTRCALL Lib "wbtrv32.dll" (ByVal OP, ByVal Pb$, Db As Any, DL As Long, Kb As Any, ByVal Kl, ByVal Kn) As Integer
Here's a sample call to open a file:

CODE

Dim pOldFilePos As typPosBlk
pOldFilePos.PosBlk = Space$(128)
lDataBuffer = ""
KeyBuffer = "filename.btr"
KeyBufLen = KEY_BUF_LEN

BufLen = Len(lDataBuffer)

status = BTRCALL(BOPEN, pOldFilePos.PosBlk, lDataBuffer, BufLen, ByVal KeyBuffer, KeyBufLen, 0)
If status <> 0 Then
    MsgBox "Error on Open. Status: " + cstr(status)
End If
Now this code may not work exactly as written.  I've cut and pasted parts of the code from a sample I got from Pervasive a while back.

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
http://www.mirtheil.com

RE: btrieve with vb6

(OP)
byRamiX (Programmer) Nov 28, 2006
first of all thanks alot for the effort.
i cut the code and pasted it in my project.
i have some questions about it..
first, i guess the dll that i declare should be installed when i install the btrieve??
2. after i run the example, the vb didn't recognize the "typPosBlk" ... what's wrong with it?
3. he asked me to make the declare as a private.. is it ok?
4. the .btr file... should i create it or where i can find it?

http://e.3arabiyat.net
http://www.brinji.com
http://byramix.blogspot.com
http://www.10-pr.com

RE: btrieve with vb6

To answer your questions:
1. Yes, the DLL should be installed as part of Btrieve.  
2. Sorry. Here's the Type declaration:

CODE

Type typPosBlk
    PosBlk As String * 128
End Type
3. How you declare it is up to you and how you are going to use it.
4. The .btr file is your data file.  It should already be created.  Where it resides is up to the application developer.

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
http://www.mirtheil.com

RE: btrieve with vb6

Usually when VB crashes like that, you've got an uninitialized variable.
I did find a couple of samples on the Pervasive web site (http://www.pervasive.com/developerzone/development_env/visualbasic.asp)
You might need to change the declare to point to WBTRV32.DLL rather than W3BTRV7.DLL.  The samples on the site are intended for PSQL V8 and V9 (the current versions).  

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
http://www.mirtheil.com

RE: btrieve with vb6

As another alternative you can build the DDF files and then use the activeX controls from Pervasive's SDK.  Once you have created the program you can set a property on the activex control that makes it so it does not require the DDF files to be present if that is your decision.  

The advantage is you can create a program much quicker as the activex controls bind the control for the database to text boxes.  The controls also take care of all binary conversions.  I use them for a number of applications and they work very well.

Gil

RE: btrieve with vb6

The only problem with the ActiveX controls would be the version of Btrieve being used.  The current controls only support PSQL 2000 or newer.  The ones that supported Btrieve 6.15 were the Smithware controls and they aren't available anymore as far as I know.  

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
http://www.mirtheil.com

RE: btrieve with vb6

(OP)
i found a help file in the bti folder and in it i found a list of dll for accessing a Btrieve workstaion engine from a windows application (16 bit)
here's the list
        WBTRCALL.DLL (Windows Requester)
        WBTRTHNK.DLL (16-bit to 32-bit Thunker)
        WBTRV32.DLL (MicroKernel Interface)
        WBTRVRES.DLL (Resource)
the question is how i can know what to declare so i can use those dll's.
i tried to declare them but it says "file not found dllName.dll"

http://e.3arabiyat.net
http://www.brinji.com
http://byramix.blogspot.com
http://www.10-pr.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close