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 > Status 3 with B_UPDATE

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-05-06, 11:52
oferg oferg is offline
Registered User
 
Join Date: Dec 2006
Posts: 1
Unhappy Status 3 with B_UPDATE

Hello everyone!


I wrote the following code (DELPHI) and when I execute the program I get status 3 (The file is not open) on update operation. Does anyone know the reason?

***********************************************
Open btrieve file============================================
fillchar(dataBuffer, sizeof(dataBuffer), #0);
fillchar(keyBuf, sizeof(keyBuf), #0);
keyNum := 0;
dataLen := 0;
keyBuf := 'c:\data\Table1.dat' + #0;
status := BTRVID(
B_OPEN,
posBlock,
dataBuffer,
dataLen,
keyBuf[1],
keyNum,
client);
Memo2.Lines.Add('------------------------------------------------');
Memo2.Lines.Add('Btrieve B_OPEN status = ' + intToStr(status));
Memo2.Lines.Add('------------------------------------------------');
//Open btrieve file============================================

//Get First Record============================================
fillchar(remarks_record, sizeof(remarks_record), #0);
fillchar(keyBuf, sizeof(keyBuf), #0);
dataLen := sizeof(remarks_record);
status := BTRVID(
B_STEP_FIRST,
posBlock,
remarks_record,
dataLen,
keyBuf[1],
keyNum,
client);
Memo2.Lines.Add('-----------------------------------------------------');
Memo2.Lines.Add('Btrieve B_Step_First status = ' + intToStr(status));
Memo2.Lines.Add('------------------------------------------------');
//Get First Record============================================

//UpDate Record============================================ =
DataLen := SizeOf(remarks_record) - SizeOf(remarks_record.Note) + Length(remarks_record.Note);
KeyNum := -1;
FillChar(KeyBuf, SizeOf(KeyBuf), #0);
Status := BTRV(B_UPDATE,
posBlock,
remarks_record,
dataLen,
KeyBuf[1],
KeyNum);
Memo2.Lines.Add('------------------------------------------------');
Memo2.Lines.Add('Btrieve B_Update status = ' + intToStr(status));
Memo2.Lines.Add('------------------------------------------------');
//UpDate Record============================================ =

//Get Next Record============================================
fillchar(remarks_record, sizeof(remarks_record), #0);
fillchar(keyBuf, sizeof(keyBuf), #0);
dataLen := sizeof(remarks_record);
KeyNum := -1;

status := BTRVID(
B_STEP_NEXT,
posBlock,
remarks_record,
dataLen,
KeyBuf[1],
keyNum,
client);
Memo2.Lines.Add('------------------------------------------------');
Memo2.Lines.Add('Btrieve B_Step_Next status = ' + intToStr(status));
Memo2.Lines.Add('------------------------------------------------');
//Get Next Record============================================

//Close btrieve file============================================
status := BTRVID(
B_CLOSE,
posBlock,
dataBuffer,
dataLen,
keyBuf[1],
keyNum,
client);
Memo2.Lines.Add('------------------------------------------------');
Memo2.Lines.Add('Btrieve B_CLOSE status = ' + intToStr(status));
Memo2.Lines.Add('------------------------------------------------');
//Close btrieve file============================================

This is the result of Memo2 after runing the program:

-----------------------------------------------------
Btrieve B_OPEN status = 0
-----------------------------------------------------
-----------------------------------------------------
Btrieve B_Step_First status = 0
-----------------------------------------------------
-----------------------------------------------------
Btrieve B_Update status = 3
-----------------------------------------------------
-----------------------------------------------------
Btrieve B_Step_Next status = 0
-----------------------------------------------------
-----------------------------------------------------
Btrieve B_CLOSE status = 0
-----------------------------------------------------

thanks a lot
Reply With Quote
  #2 (permalink)  
Old 12-05-06, 15:52
mirtheil mirtheil is offline
Registered User
 
Join Date: Dec 2001
Posts: 1,026
About the only time you'd get a status 3 like this would be if something is happening to the Position Block variable (posBlock in your code). Check to make sure it's correct before the Update call. Also check the Pervasive Monitor to make sure the file is open both before and after the Update.
__________________
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
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