Não consigo recuperar o Ultimo ID inserido no MSSQL com cached updata abilitado e campo id autoincremento usando master detail alguem ja conseguiu algo?
Thanks;
Decio
Problema Recuperar Ultimo ID MSSQL
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Problema Recuperar Ultimo ID MSSQL
Please describe your scenario in more details. Please provide the following information:
1. DDL/DML scripts of the tables you use;
2. The sample of code that causes the issue. A test project will be appreciated. You can send us a test project by using the contact form on our website http://www.devart.com/company/contactform.html
3. Which behavior do you get?
4. Which behavior do you expect?
1. DDL/DML scripts of the tables you use;
2. The sample of code that causes the issue. A test project will be appreciated. You can send us a test project by using the contact form on our website http://www.devart.com/company/contactform.html
3. Which behavior do you get?
4. Which behavior do you expect?
-
- Posts: 3
- Joined: Mon 07 Jul 2014 14:43
Re: Problema Recuperar Ultimo ID MSSQL
Usando Uniquery Delphi 7 MSSQL 2012 uma simples select em uma tabela configurando os insert e update ligada a uma master detail porem quando se aplica o apply nao consigo retornoa ro id identity deo MSSQL
gratos
gratos
Re: Problema Recuperar Ultimo ID MSSQL
If you are using your own INSERT SQL query in the dataset, then to retrieve the inserted record ID, you should :
- set TUniQuery.Options.ReturnParams to True
- in the TUniQuery.BeforeUpdateExecute event specify explicitly the ptInputOutput parameter type for the Identity field
For example:
- set TUniQuery.Options.ReturnParams to True
- in the TUniQuery.BeforeUpdateExecute event specify explicitly the ptInputOutput parameter type for the Identity field
For example:
Code: Select all
DetailUniQuery.Options.ReturnParams := True;
...
procedure TForm1.DetailUniQueryBeforeUpdateExecute(Sender: TDataSet;
StatementTypes: TStatementTypes; Params: TDAParams);
begin
if StatementTypes = [stInsert] then
Params.ParamByName('ID').ParamType := ptInputOutput;
end;
-
- Posts: 3
- Joined: Mon 07 Jul 2014 14:43
Re: Problema Recuperar Ultimo ID MSSQL
Esse procedimento funciona com cached Update ativo?
]
Obrigado
]
Obrigado
Re: Problema Recuperar Ultimo ID MSSQL
The above sample is just for updating the value of an auto-incremental or calculated field in dataset when using cached data updates.