TIBSQL stayed prepared and FieldByName('FieldX').AsString
Hi,
We have a TIBSQL component with a parameterized query like :
TIBSQL.SQL.Text :=
'SELECT ' +
' t1.Description As "Description1", ' +
' t2.Description As "Description2", ' +
' t3.Description As "Description3" ' +
'FROM ' +
' Table1 t1, Table2 t2 , Table3 t3 ' +
'WHERE ' +
' t1.Code = :Code1 and ' +
' t2.Code = :Code2 and ' +
' t3.Code = :Code3 ';
In a loop the params where filled and ExecQuery is called.
the result string is all three strings together.
Result :=
FieldByName('Description1').AsString + ' ' +
FieldByName('Description2').AsString + ' ' +
FieldByName('Description3').AsString;
This works fine when there's always a result-set.
But when the query returns no results (EOF = True) all
FieldByName('DescriptionX').AsString returns the results of the previous
executed query results.
Is this a correct behauviour? So yes why ?
Regards,
Arno