ds.Fields[0].Name Error
Example:
“SELECT FIRST_NAME AS PERSON_NAME FROM TABLE_NAME”;
Error1: Fields[0].Name resulting “FIRST_NAME” error.
ds.FieldByName('PERSON_NAME').Name => Runtime Error: Field 'PERSON_NAME' not found
Comments (7)
-
repo owner -
reporter Sorry for the lack of information.
https://github.com/FirebirdSQL/firebird/releases/download/R2_5_9/Firebird-2.5.9.27139_0_x64.exe
script and database : http://golsistemas.com.br/dbtest.rar
-
repo owner Did you use the Firebird, the UIB or the ODBC driver ?
The Firebird driver is wrapping SynDBFirebird, which is not finished nor functional at the moment (cf. https://github.com/synopse/mORMot/blob/master/SynDBFirebird.pas).
The UIB and ODBC drivers should work however.
-
reporter fbclient.dll UIB
Print(DataBase.Create('UIB', ['192.168.1.28/3050:K:\bd\producao\separar\DIGIPONTOVAZIO.fdb', 'SYSDBA', 'masterkey','NONE','C:\Windows\SysWOW64\fbclient25_32.dll']) .Query(SqlQuery) .StringifyAll);
<?pas
Print( #'{
"fields":[
{"name":"PERSON_NAME","label":"Empresa"}
,{"name":"PERSO_NAME","label":"Cidade"}
,{"name":"PERSON_ID","label":"ID"}
]
,"data":
');const SqlQuery =" select NM_EMPRESA AS PERSON_NAME , NM_CIDADE AS PERSO_NAME , CD_EMPRESA as PERSON_ID from sysempresa "; Print(DataBase.Create('UIB', ['192.168.1.28/3050:K:\bd\producao\separar\DIGIPONTOVAZIO.fdb', 'SYSDBA', 'masterkey','NONE','C:\Windows\SysWOW64\fbclient25_32.dll']) .Query(SqlQuery) .StringifyAll); Print("}");
exit;
case WebRequest.Authentication of
WebAuthentication.None :
WebResponse.RequestAuthentication(WebAuthentication.Negotiate);
WebAuthentication.NTLM .. WebAuthentication.Kerberos :
Print(DataBase.Create('UIB', ['192.168.1.28/3050:K:\bd\producao\separar\DIGIPONTOVAZIO.fdb', 'SYSDBA', 'masterkey','WIN1252','C:\Windows\SysWOW64\fbclient.dll'])
.Query(WebRequest.QueryFields)
.StringifyAll);
else
WebResponse.StatusCode := 401;
end;?>
-
reporter script used into http://golsistemas.com.br/dbtest.rar
-
repo owner Ok! got it, you mean it’s using the field name rather than the aliased name ?
-
repo owner - changed status to resolved
Fixed Issue
#164, use AliasName rather than SqlName in UIB driver→ <<cset 5d6b8f6bdf6f>>
- Log in to comment
Do you have any code or details that would help reproducing the issue?
I tried with the following snippet and it worked:
var db := new DataBase('SQLite');
db.Exec('create table TABLE_NAME (FIRST_NAME text)');
var ds := db.Query('SELECT FIRST_NAME AS PERSON_NAME FROM TABLE_NAME');
db.Exec("insert into TABLE_NAME VALUES ('test')");
PrintLn(ds.Fields[0].Name);
PrintLn(ds.FieldByName('PERSON_NAME').Name);