auto incremento - SQLConnection.Execute(SQLstmt, nil, @ResultSet) depreciate
No help do Delphi XE3 diz
function Execute(const SQL: string; Params: TParams): Integer; overload;
function Execute(const SQL: string; Params: TParams; var ResultSet: TDataSet): Integer; overload;
function Execute(const SQL: string; Params: TParams; ResultSet: Pointer): Integer; overload; deprecated 'Use overloaded method instead';
rotina de auto incremento
procedure TDMCustomer.cds_customerNewRecord(DataSet: TDataSet);
var
ResultSet: TCustomSQLDataSet;
SQLstmt: string;
begin
SQLstmt := 'SELECT gen_id(GCUSTOMER,1)' + 'as VALOR from RDB$DATABASE;';
ResultSet := nil;
try
DMCustomer.SQLConnection.Execute(SQLstmt, nil, @ResultSet);
if Assigned(ResultSet) then
begin
cds_customer.FieldByName('CUSTOMERID').AsInteger :=
ResultSet.FieldByName('VALOR').AsInteger;
end;
finally
ResultSet.Free;
end;
end;
Mas, o valor de CUSTOMERID não pega? Por favor, alguem pode me ajudar?
function Execute(const SQL: string; Params: TParams): Integer; overload;
function Execute(const SQL: string; Params: TParams; var ResultSet: TDataSet): Integer; overload;
function Execute(const SQL: string; Params: TParams; ResultSet: Pointer): Integer; overload; deprecated 'Use overloaded method instead';
rotina de auto incremento
procedure TDMCustomer.cds_customerNewRecord(DataSet: TDataSet);
var
ResultSet: TCustomSQLDataSet;
SQLstmt: string;
begin
SQLstmt := 'SELECT gen_id(GCUSTOMER,1)' + 'as VALOR from RDB$DATABASE;';
ResultSet := nil;
try
DMCustomer.SQLConnection.Execute(SQLstmt, nil, @ResultSet);
if Assigned(ResultSet) then
begin
cds_customer.FieldByName('CUSTOMERID').AsInteger :=
ResultSet.FieldByName('VALOR').AsInteger;
end;
finally
ResultSet.Free;
end;
end;
Mas, o valor de CUSTOMERID não pega? Por favor, alguem pode me ajudar?
Celso Saito
Curtidas 0
Respostas
Alisson Santos
09/10/2012
Chamado fechado está em duplicidade
GOSTEI 0