Subject Re: [IBO] Re: Keysource & Master Relationships Problem
Author Helen Borrie (TeamIBO)
At 03:21 AM 23-05-02 +0000, you wrote:

>What's the difference between using query.FieldByName and just Query
>['FieldName'] ? What's wrong with the way I was doing it?

That is just a reference to the TIB_Column object. This object has lots of
properties, of which Value is one. So you could use
Query['FieldName'].Value if you want to. As I was copy-pasting from the
passage above, where I applied the Row.ByName('FieldName').AsWhatever
method to access the column's value, you got FieldByName().

Given the flakiness of Delphi's implementation of variant types, I never
use the Value property, preferring to go the safe route and cast explicitly
using the As... methods.

I've seen arguments for "going the short route" and trusting the variant,
but, considering that here you are dealing with one and only one row at a
time, I consider the extra method call for a handful of fields
irrelevant. I hate having users see messages like "Type mismatch" or,
worse, "Internal error nnn". If there are going to be errors, I want them
to be ones the users make and can fix.

regards,
Helen Borrie (TeamIBO Support)

** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at
www.ibobjects.com