Hello Friends TIBCQuery fails to capture the ID in the insert ?
begin
with the TblSQL
begin
if Active then
Close ;
Sql.Clear ;
SQL.Add ( ' insert into PDV_TURNOS ( TURNO_ID , ' +
' TURNO_DATA ' +
' TURNO_HORA ' +
' TURNO_CAIXA ' +
' TURNO_OPERADOR ) ' +
' Values ( : TURNO_ID , ' +
': TURNO_DATA ' +
': TURNO_HORA ' +
': TURNO_CAIXA ' +
': TURNO_OPERADOR ) ' +
' Returning TURNO_ID ' ) ;
Options.ReturnParams : = True ;
ParamCheck : = True ;
KeyGenerator : = ' GEN_PDV_TURNOS_ID ' ;
KeyFields : = ' TURNO_ID ';
Params [ 1 ] AsDateTime : = Date ; .
Params [ 2 ] AsDateTime : = Time ; .
Params [ 3 ] As Integer : = 2 ; .
Params [ 4 ] As Integer : = 1 ; .
ExecSQL ;
ShowMessage ( ParamByName ( ' TURNO_ID ' ) AsString . ) ; // not Work...
end ;
end ;
In FibPlusQuery, FiredacQuery and SQLQuery Works Only IBDAC they can not help me.
Returning ID on TIBCQuery
Re: Returning ID on TIBCQuery
For the fields, that are specified after RETURNING, there are automatically generated output parameters with the RET_ prefix.
This is described in the documentation:
http://www.devart.com/ibdac/docs/index. ... ataset.htm
In your example you should use
instead of
This is described in the documentation:
http://www.devart.com/ibdac/docs/index. ... ataset.htm
In your example you should use
Code: Select all
ShowMessage(ParamByName('RET_TURNO_ID').AsString);Code: Select all
ShowMessage(ParamByName('TURNO_ID').AsString);