VB5 using Btrieve

Posted on 1997-09-25
Medium Priority
Last Modified: 2008-03-06
I receive an intermittent 'Invalid Page Fault' when accessing the Btrieve engine from a VB5 project.

I am using the 1996 version of the Btrieve WBTRV32.DLL

Funnily enough, the error doesn't just happen on the actual BtrCall calls, it often happens on an End Sub and various other places.

Changing the ByVal's in the actual call has an effect. However, I have not been able to find a combination that totally eliminates the problem.

The fault does not necessarily happen the first time the code is run. Sometimes it takes 12 runs for it to happen. Once it took 44 times.

Help !
Question by:TD092397
  • 5
  • 2

Expert Comment

ID: 1435839
What Access method are you using? RDO?  Are you using the Pervasive ODBC driver?  Is the Jet engine involved? Please tell me more about the configuration involved. thx!

Accepted Solution

cymbolic earned 800 total points
ID: 1435840
There is a more recent version.  I recently updated to it from pervasive software, and it may solve your problem.  My version is dated 2/12/97 and it's 68,096 in size.  Betcha this fixes it! (nobody admits to problems anymore, they just make you buy an upgrade, and suddenly, the problem goes away!)

Author Comment

ID: 1435841

Funnily enough our support manager tried it out yesterday afternoon and it didn't help. I've tried it as well. No go.

I'm not using RDO, ODBC or the Jet engine. I use a function declaration (BtrCall) and maintain all aspects of a particular file within a class instance.

To give you an idea:
The sample code that comes with the developers' kit works. Which peed me off no end ! So I changed it.
First I remmed the code that creates the file. Then I put the rest in a 0-100 loop (remember you have to run it a few times).
It ran fine.
Second I changed the data buffer being passed to a fixed-length string of len = 585 instead of a user-defined type. Crash !

Unfortunately, changing my class to use a user-defined type doesn't help.

By the way, my background: I have been using VB for 4 years and Btrieve for 3 months. Just to give you an idea on what level you would need to talk to me. (Also I'm really stupid).

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Expert Comment

ID: 1435842
In these modern software environments, everybody is dumb, but few are honest enough to admit it!  It's become a software minefield out there, with untested software issued by major suppliers desparately seeking plausible deniability!  Stupid hidden workarounds to major disabling operating problems are proposed that still leave the program functionally unuseable, or unscalable to real world sized applications.  I have been trying off and on to get acceptable performance from the btrieve ODBC using VB 4 and RDO, in order to perform massive extracts from very large btrieve files for loading data warehose systems, and have been continually frustrated by an inability to achieve acceptable performance.  This is particularly frustrating, because I know that native btrieve access under DOS is blazingly fast for what I'm trying to do.  

You have to know the page fault is in the .DLL, because that operates in your own address space under windows.  It's only a matter of timing that positions the page fault in any place in your code.

You might check out your BTI.INI file in your windows directory, there are a number of options there that might mask the problem enough to make it useable.  Also the readme files have some information on increasing a few parameters that might help as well.  Let me know if you find any good performance hints/fixes.  I'm probably dumber than you on this one.  cymbolic@aol.com or doug.taylor@hboc.com


Expert Comment

ID: 1435843
P.S. go to www.pervasive-sw.com and check out the article in the tech papers section called "Advanced Tuning for the Microkernal Engine"  It details the option settings and their meanings.  Also, I noted one reference under page fault regarding applications with out enough stack space causing page faults.  Hey, you aren't running any recursive routines are you?  That could cramp your stack space style in a hurry!

Author Comment

ID: 1435844
The problem 'seems' to be solved. There were three different factors involved:

1.) If the data buffer is a user-defined type, do not use ByVal in the call. Otherwise, use it. This makes no sense, considering the data buffer needs to have info returned to it, but hey ! that's life.

2.) The key number argument in the Open call. This is weird. If you declare the variable you pass through explicitly as an integer, then you crash. Use DefInt A-Z, declare the variable with no type specification, and it works. ???

3.) The variable you pass through as the data buffer in the open call has to be the same variable as is used in the rest of the calls. It also has to have module-level scope.

These may not be right (they certainly don't make much sense), but ensuring these 3 issues were dealt with correctly has solved my problem. It took me 3 weeks to figure it out though, so I hope this helps someone else from going thru the same S***.

Thanks very much for your help, cymbolic. Sorry I can't credit you with solving the problem. Hope you manage to sort yours out.

p.s. What do I do now with this problem ?

Expert Comment

ID: 1435845
Geez..you're right, none of these changes are intuitive!  How did you figure them out?  I've seldom found anything really useable on the pervasive-sw site.

I think the easiest tning to do is accept the answer, but adjust the points down to zero.  That way the slate's cleared, but the info sticks around for others to view.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question