Subject RE: [IBO] Apparent bug in assigning a qry.fieldbyname to a parameter in DSQL
Author Jason Wharton
So glad you figured this out!
Thanks for letting me know.

From: []
Sent: Sunday, August 12, 2018 12:36 AM
Subject: Re: [IBO] Apparent bug in assigning a qry.fieldbyname to a parameter in DSQL

Hi, Jason:

I finally figured it out:

I was doing:

with qry do
//set up qry and open...
with dsql do
//set up dsql, prepare
   with qry do //this query was a singleton opened above the use of the dsql
  Parambyname('param').asString := FieldByName('fieldname').asString;

Clearly, the code was seeing some ambiguity with ParamByName's owner.

When I removed the "with qry do" and explicitly referenced qry.fieldbyname(), everything worked fine.

Of course, it took hours to figure this out and now I have less hair.

Thank you,


On 8/11/2018 7:08 PM, 'Jason Wharton' jason@... [IBObjects] wrote:
This sounds like something quite strange.
I'll probably need to see a sample app if you can reproduce it.
Let me know.
Jason Wharton

From: []
Sent: Saturday, August 11, 2018 12:19 PM
To: IBObjects Listserve
Subject: [IBO] Apparent bug in assigning a qry.fieldbyname to a parameter in DSQL



I have a weird, frustrating apparent bug:

I am using a created IB_Cursor, "qry",  to select from a local database
a singleton. Then with a IB_DSQL I am updating a remote database table.

In the DSQL, I am using parameterized statements (e.g. FieldName and
:FieldName after VALUES).

After Prepare, I assign the values to the parameters, using

ParambyName('FieldName').asString := qry.FieldByName('fieldname').asString;

On the above line I am getting the error, "Fieldname not found,
FieldName". This is coming from IB_Components.TIB_Row.ByName assertion,
calling GetByName(). I am unable to trace (not able to set break
points--during runtime the breakpoints disappear, F7 does not work) the
IBO code.

On checking both values for ParambyName('FieldName').asString and
qry.FieldByName('fieldname').asString during runtime, they are as
expected. In other words, the field, FieldName, does exist in the qry

And the fieldname does exist in both tables.

Any ideas or suggestions on what is going on here?

Sometimes I have found problems resolve by changing from a IB_Cursor to
a IB_Query. That did not resolve this issue.

Thank you,


This email has been checked for viruses by Avast antivirus software.