dbTalk Databases Forums  

Question about Btrieve programming

comp.databases.btrieve comp.databases.btrieve


Discuss Question about Btrieve programming in the comp.databases.btrieve forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Enzo
 
Posts: n/a

Default Question about Btrieve programming - 03-13-2006 , 06:01 AM






Hi to all.
I'm new to this ng. And i'm almost new to btrieve programming.
The question.
I'm trying to get data from a Btrieve database(6.15) from within a VB.net
module. I use:
DECLARE FUNCTION BTRCALL LIB "Wbtrv32.dll" (Byval oc as ushort, byval pb as
string, <Marshalasattribute(unmanagedtype.asany)> byval Db as object, byval
Dl as integer, byval Kb as string, <Marshalasattribute(unmanagedtype.asany)>
byval Kl as object, byVal Kn as char) as integer

when I call the function as follow:
status = BTRCALL(B_Open, Pblock, DataBuf, BufLen, KeyBuf, KeyBufLen, "0")
where:
B_Open is a costant = 0
PBlock is a space(128)
DataBuf as RecordBuffer
buflen as integer
keybuf = Filename (C:\Ex\Data.btr")
keybuflen = space(255)

What I get when it starts is an error referring to keybuflen which "attempts
to read or write a protected memory area".
Where is the problem?
thanks in advance



Reply With Quote
  #2  
Old   
FrisbeeŽ
 
Posts: n/a

Default Re: Question about Btrieve programming - 03-13-2006 , 10:03 AM






"Enzo" <mmm (AT) mmm (DOT) it> wrote

Quote:
Hi to all.
I'm new to this ng. And i'm almost new to btrieve programming.
The question.
I'm trying to get data from a Btrieve database(6.15) from within a VB.net
module. I use:
DECLARE FUNCTION BTRCALL LIB "Wbtrv32.dll" (Byval oc as ushort, byval pb
as string, <Marshalasattribute(unmanagedtype.asany)> byval Db as object,
byval Dl as integer, byval Kb as string,
Marshalasattribute(unmanagedtype.asany)> byval Kl as object, byVal Kn as
char) as integer

when I call the function as follow:
status = BTRCALL(B_Open, Pblock, DataBuf, BufLen, KeyBuf, KeyBufLen, "0")
where:
B_Open is a costant = 0
PBlock is a space(128)
DataBuf as RecordBuffer
buflen as integer
keybuf = Filename (C:\Ex\Data.btr")
keybuflen = space(255)

What I get when it starts is an error referring to keybuflen which
"attempts to read or write a protected memory area".
Where is the problem?
thanks in advance
KeyBufLen is a numeric, specifically, the length of your KeyBuf string.




Reply With Quote
  #3  
Old   
Enzo
 
Posts: n/a

Default Re: Question about Btrieve programming - 03-13-2006 , 11:39 AM



Have changed to Int64 both the declaration and the variable and still have
the same error.
(Begging your pardon for my incopetence I'm relatively new in programming
vb.net, by now I have written in VBA)
thanks again for your help
DECLARE FUNCTION BTRCALL LIB "Wbtrv32.dll" (Byval oc as ushort, byval pb as
string, <Marshalasattribute(unmanagedtype.asany)> byval Db as object, byval
Dl as integer, byval Kb as string, <Marshalasattribute(unmanagedtype.I8)>
byval Kl as Int64, byVal Kn as char) as integer


P.S. I'm trying to follow istructions written in a btrieve manual Pervasive
have posted on their site.



Reply With Quote
  #4  
Old   
FrisbeeŽ
 
Posts: n/a

Default Re: Question about Btrieve programming - 03-14-2006 , 07:58 AM



"Enzo" <mmm (AT) mmm (DOT) it> wrote

Quote:
Have changed to Int64 both the declaration and the variable and still have
the same error.
(Begging your pardon for my incopetence I'm relatively new in programming
vb.net, by now I have written in VBA)
thanks again for your help
DECLARE FUNCTION BTRCALL LIB "Wbtrv32.dll" (Byval oc as ushort, byval pb
as string, <Marshalasattribute(unmanagedtype.asany)> byval Db as object,
byval Dl as integer, byval Kb as string,
Marshalasattribute(unmanagedtype.I8)> byval Kl as Int64, byVal Kn as
char) as integer


P.S. I'm trying to follow istructions written in a btrieve manual
Pervasive have posted on their site.
Without checking, I believe the key buffer length parameter should be a
short integer, but possibly a long integer. Definitely not a 64-bit
integer, though.




Reply With Quote
  #5  
Old   
Bill Bach
 
Posts: n/a

Default Re: Question about Btrieve programming - 03-14-2006 , 09:19 PM



It most definitely should be an integer.

Declare Function btrcall Lib "wbtrv32.dll" (ByVal Op% AS Integer, ByVal
Pb$, Db As Any, DL% AS Integer, Kb As Any, ByVal Kl% AS Integer, ByVal
Kn% AS Integer) AS Integer

Of course, nobody was worried about 64-bit integers in 1994 when this
product was released.
BB

Frisbee. wrote:

Quote:
"Enzo" <mmm (AT) mmm (DOT) it> wrote in message
news:4415ae47$0$29111$5fc30a8 (AT) news (DOT) tiscali.it...
Have changed to Int64 both the declaration and the variable and
still have the same error.
(Begging your pardon for my incopetence I'm relatively new in
programming vb.net, by now I have written in VBA)
thanks again for your help
DECLARE FUNCTION BTRCALL LIB "Wbtrv32.dll" (Byval oc as ushort,
byval pb as string, <Marshalasattribute(unmanagedtype.asany)> byval
Db as object, byval Dl as integer, byval Kb as string,
Marshalasattribute(unmanagedtype.I8)> byval Kl as Int64, byVal Kn
as char) as integer


P.S. I'm trying to follow istructions written in a btrieve manual
Pervasive have posted on their site.

Without checking, I believe the key buffer length parameter should be
a short integer, but possibly a long integer. Definitely not a
64-bit integer, though.


Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.