Board index » delphi » deleted dbase records

deleted dbase records

Has anyone ever managed to write a filter that will show only deleted
records in a grid. I have tried various BDE API functions but can only get
the Table is busy  message when the filter is invoked.

Sandy Ferguson

 

Re:deleted dbase records


To show deleted records, use DbiSetProp

to know if a record is deleted or not, use DbiGetRecord

If you dont want to show not deleted record, i think you can do it in the
OnFilter Event

Example:
  (define pb_value to 'true' to show deleted records)
You must use DBITypes, DBIErrs, DBIProcs units to compile.

procedure SetShowDeleted(p_Table: TTable; pb_Value: Boolean);
var
  rslt: DBIResult;
  szErrMsg: DBIMSG;
begin
  p_Table.DisableControls;
  try
    rslt := DbiSetProp(hDBIObj(p_Table.Handle), curSOFTDELETEON,
LongInt(pb_Value));
    try
    if rslt <> DBIERR_NONE
      then
      begin
        DbiGetErrorString(rslt, szErrMsg);
        raise Exception.Create(StrPas(szErrMsg));
      end;
    except
      on E: EDBEngineError do ShowMessage(E.Message);
      on E: Exception do ShowMessage(E.Message);
    end;
    p_Table.Refresh;
  finally
    p_Table.EnableControls;
  end;
end;

to
var l_Proprietes: RecProps;
begin
  Table.UpdateCursorPos;
  DbiGetRecord(Table.Handle, DbiNoLock, nil, @l_Proprietes);
  if l_Proprietes.bDeleteFlag
    then ...

Sandy Ferguson a crit :

Quote
> Has anyone ever managed to write a filter that will show only deleted
> records in a grid. I have tried various BDE API functions but can only get
> the Table is busy  message when the filter is invoked.

> Sandy Ferguson

Other Threads