Subject Re: [IBO] Getting column reference from TIB_Cursor?
Author Helen Borrie
At 11:04 PM 29/04/2003 -0700, you wrote:
>At 03:56 PM 4/30/2003 +1000, you wrote:
> >At 10:39 PM 29/04/2003 -0700, you wrote:
> > >Yes, I did, and it won't compile. I get the following error (BCB4):
> > >
> > >'Fields' is not a member of 'TIB_Row'.
> > >
> > >Here is my code:
> > >
> > > ScratchCursorX->Close();
> > > ScratchCursorX->SQL->Clear();
> > > ScratchCursorX->SQL->Add(thequery);
> > > ScratchCursorX->Open();
> > > if (ScratchCursorX->Eof)
> > > return 0;
> > > else
> > > return ScratchCursorX->Fields->Fields[0].AsInteger;
> > >
> > >It's the last line that causes the compile to generate the above error.
> >
> >Don't call Open on TIB_Cursor. It's a unidirectional cursor so Open takes
> >you nowhere except BOF.
> >
> >Call First. And remember to test Prepared and call it if not Prepared.
>
>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?


>Also, wouldn't the query have to be prepared if I just executed it?

Hmmm. Are you saying that this is a DML query, not a SELECT query? If so,
then there is no Fields object, unless of course you are executing a SP
that returns a row.

More information seems necessary. The text of 'theQuery' seems a good
place to start.

About Prepare. All queries (without exception) have to be prepared. Some
methods of some DAOs perform a Prepare automatically, some don't. Since
you don't want to Prepare a query that is already prepared, you should
*test* Prepared before you refer to a column object....if you actually have
column objects, that is...

Helen