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 > Get Equal with Segmented Key

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-22-04, 23:23
olapworm olapworm is offline
Registered User
 
Join Date: Aug 2004
Posts: 3
Get Equal with Segmented Key

Please help.

I'm using Btrieve API in VB and I'm trying to use the get operation
(GET EQUAL) to set the position of the record that I wan't to get.

I always received status 4 or status 9 when I issue the Get Equal
command. My key is segmented first is string len 15 and the 2nd is
an integer.

this is how I assign it to KeyBuffer:

KeyBuffer = String15 & Trim(Str(IntKey))

then GET Equal

Hope to hear from you guys.

Thanks
Reply With Quote
  #2 (permalink)  
Old 08-23-04, 08:03
mirtheil mirtheil is offline
Registered User
 
Join Date: Dec 2001
Posts: 1,026
How is your KeyBuffer declared? It probably should be a User Defined Type like:
type KBIndex
strField as string * 15
intField as integer
end type
Integers aren't stored as strings (or ASCII characters) in a Btrieve file, they are stored as byte swapped Intel integers.
You can also turn on the MKDE tracing to see exactly what's being sent on the Get Equal.
__________________
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 08-24-04, 00:47
olapworm olapworm is offline
Registered User
 
Join Date: Aug 2004
Posts: 3
Unhappy

It was defined like this:
Key number was set to 0

type sKey0
Batchno as String*15
Seq(0 to 1) as Byte
end type

and inside my code

Dim sKeyBuf as sKey0
Dim iSeq as Integer

iSeq = 2

sKeyBuf.Batchno = "000000000001008"

CopyMemory sKeyBuf.Seq, iSeq, 2

Status = BTRCALL(BGETEQUAL, pOldFilePos, lRecBuffer(1), BufLen, ByVal sKeyBuf, KeyBufLen, KeyNum)

and most of the Status returned was equal to 4. I have 19 records and if
I browse it to SQL Data Manager Batchno="000000000001008" and Seq=2 exist.

Any other suggestion?

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