Subject | Re: [IBO] Error Field Not Found in FieldByName After update 4.9 to 5.7 |
---|---|
Author | setysvar |
Post date | 2015-08-10T14:59:06Z |
Den 10.08.2015 14:38, skrev Sergio De
melo serginhoievec@... [IBObjects]:
Good morning,I'm preparing a 2010 Delphi migration to Delphi XE8. Now I use Delphi 2010 with IBO 4.9.9. I am testing my Delphi XE8 with Eval Version ibo5.7.5_2275_Eval, but I have a big problem, when a use a alias in a field when I execute the command FieldByName an error occurs field not found. Example, select name_fun as “name” from mytable, if a use iboQuery.FieldByName(‘NAME’).AsString Field not found error, but if a use iboQuery.FieldByName(‘“NAME”’ ).AsString it works.Sorry, my mistakes in English.
Using double quotes should make the alias case sensitive, and iboQuery.FieldByName('NAME').AsString should not find anything as "name". Neither should iboQuery.FieldByName('"NAME"').AsString (if it does, I'm tempted to call it an error, although I don't know whether it is an IBO error or TQuery error), whereas iboQuery.FieldByName('"name"').AsString should work. I don't use tiboQuery myself (only TIB_Query), so this is just the way I would expect things to work, and they may behave differently in real life.
I would recommend you to change your query to
select name_fun as name from mytable
so that the name isn't case sensitive.
HTH,
Set