Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2006
    Posts
    1

    Unhappy Unanswered: 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

  2. #2
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •