Board index » delphi » ADO Seek Error

ADO Seek Error

Hi,

This just a remark :

If you use a TADODataSet (Funny name why not TADORecordset ?) with
CommandType := cmdTableDirect and
CursorType := ctKeySet

If you use an empty table, then the Seek method will raise an EOLEException
:
"Either BOF or EOF is True, or the current record has been deleted.....'

So we have to test for empty tables before using Seek.

Example :

function Seek(const KeyValues: Variant; SeekOption: TSeekOption =
soFirstEQ): Boolean;

function TCustomADODataSet.Seek(const KeyValues: Variant;
  SeekOption: TSeekOption = soFirstEQ): Boolean;
begin
    If (BOF and EOF) then
        Result := False
    else
        Result := inherited Seek(KeyValues, SeekOptions);
end;

I hope that Mark will post an official correction soon (Hello Mark ;-)

Alex

 

Re:ADO Seek Error


Quote
Alexandre DANVY <alex-...@ebp.fr> wrote in message

news:7ufecu$p6e14@forums.borland.com...

Quote
> I hope that Mark will post an official correction soon (Hello Mark ;-)

I'll check it out.  Thanks for the report.

Mark

Re:ADO Seek Error


Quote
Alexandre DANVY <alex-...@ebp.fr> wrote in message

news:7ufecu$p6e14@forums.borland.com...

Quote
> If you use an empty table, then the Seek method will raise an EOLEException
> :
> "Either BOF or EOF is True, or the current record has been deleted.....'

Just FYI, this appears to be an ADO bug.  At least when using the MDAC 2.5 runtime
I cannot reproduce the error.  However, I will add a workaround to the VCL code
and put a Try/Except block around the call to recordset.seek to avoid the
exception being raised.

Mark

Other Threads