Subject | Re: [IBO] TIB_DSQL-prevent exception on empty result |
---|---|
Author | Helen Borrie |
Post date | 2005-05-17T14:50:25Z |
At 04:33 PM 17/05/2005 +0200, you wrote:
component. It can receive return parameters from executing an executable
stored procedure, but not a dataset from a cursor. Use an IB_Cursor and
call its First method (not Open).
begin
First;
if (EOF and BOF) then // equivalent to IsEmpty
blah;
Helen
>I'm using TIB_DSQL to do a number of single record basedDon't use a SELECT statement in a IB_DSQL - it is not a dataset
>operations and it's working fine, but ...
>----------------------------
> sSQL:='select first(1) REF from '+MainQuery.Tablename+' '+
> 'Where (('+SortIndex+'<:P1) or ('+SortIndex+'=:P1 and
>REF<:P2)) '+
> 'Order by '+SortIndex+' DESC,REF DESC';
> SearchQuery.sql.clear;
> SearchQuery.sql.add(ssql);
> SearchQuery.Prepare;
> SearchQuery.Params[0].AsString:=Suchbegriff;
> SearchQuery.Params[1].Asinteger:=RefAlt;
> try
> SearchQuery.ExecSQL;
> RefNeu:=SearchQuery.FieldByName('REF').AsInteger;
> MainQuery.ParamByName('REFNO').AsInteger:=RefNeu;
> Except //kein neuer Satz gefunden; also den letzten Ansteuern
> SQL_First_Ref_on_actual_Sort(MainQuery,SearchQuery);
> End;
>-----------------------------------
>
>My question(s):
>1. The ExecSQL is firing an Debugger Exception, if the result of the
>sql is empty. How can this Exception be prevented?
component. It can receive return parameters from executing an executable
stored procedure, but not a dataset from a cursor. Use an IB_Cursor and
call its First method (not Open).
>2. If there is a solution for 1., how do I determine, if the resultwith myIB_Cursor do
>"isempty"? I haven't found a function like tib_query.isempty.
begin
First;
if (EOF and BOF) then // equivalent to IsEmpty
blah;
Helen