Subject Re: [IBO] Getting column reference from TIB_Cursor?
Author Joe Martinez
> >Ok. I can do that, but that doesn't explain why it doesn't compile,
> does it?
>
>I don't know, since this is just a snippet. What is it - a function?

Yes. Here's the entire function:

long __fastcall TMainForm::QueryOneLong(String thequery)
{
ScratchCursorX->Close();
ScratchCursorX->SQL->Clear();
ScratchCursorX->SQL->Add(thequery);
ScratchCursorX->Open();
if (ScratchCursorX->Eof)
return 0;
else
return ScratchCursorX->Fields->Fields[0].AsInteger;
}


The query that is executed will always be a select statement that returns a
single row with a single Integer column. Example:

select myint from table1 where mykey = 123

According to the IBO help file, TIB_Cursor->Fields is a TIB_Row. TIB_Row
does not have a Fields property.

Oh, I think I just found the answer to my question. It should be:

return ScratchCursorX->Fields->Columns[0].AsInteger;

-Joe