Subject | Re: [IBO] Getting column reference from TIB_Cursor? |
---|---|
Author | Joe Martinez |
Post date | 2003-04-30T07:16:31Z |
> >Ok. I can do that, but that doesn't explain why it doesn't compile,Yes. Here's the entire function:
> does it?
>
>I don't know, since this is just a snippet. What is it - a 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