Subject RE: [IBO] SQL Error code = -804
Author Thomas Steinmaurer
Hi Phil,


> Actually, 2 questions.
>
> First, a quickie: What is the "proper" way to test for "is the
> result set
> empty?"
> RowsSelected, RowsAffected, EOF and BOF, try..except, or ??

Try IsEmpty.

> Second,
>
> This seems to be a simple, direct TIB_DSQL, but on the 2nd
> execution of it
> (and thereafter), I receive:
>
> SQL Error code = -804
> SQLDA missing or incorrect version, or incorrect number/type of variables.
>
> I have read Geoff Worboy's post of Jul 25, 2001 1:30 pm and "none of the
> above worked"
>
> The SQL.Text is:
>
> select * from PROFILES
> where PROFILE_ID = :PROFILE_ID
>
> The Delphi code is also simple:
>
> with ThorProf_DSQL do
> try
> if not Prepared then Prepare;

You always need to explicit Unprepare your statement before executing.

if Prepared then Unprepare;

> ParamByName('PROFILE_ID').AsInteger :=
> ThorSubsQuery.FieldByName('PROFILE_LIST').AsInteger;
> Execute;
> slTmp.CommaText := FieldByName('Parameters').AsString;
> // [snip]
> except
> on E:Exception do
> ShowReadErrorMsg('ThorProf_DSQL',E);
> end;{with ThorProf_DSQL, try..except}
>
> Does the TIB_DSQL remain Active/Open & need Closing? If so, I
> can't find a
> Close method.
>

Hope this helps!
Thomas