Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ADOCommand - How to get a return value?

730 views
Skip to first unread message

Marco Napoli

unread,
Jul 14, 2003, 2:19:25 PM7/14/03
to
I have Delphi 6.0 and I am suing the ADOCommand, which runs bunch of SQL
Statement to a MS SQL Server. At the end of the code I have a statement of
RETURN nMyNewId.

I cant figure out how to get this nMyNewId back from the ADOCommand once
executed.

// Bund of SQL Statements....
// ....
nMyNewId:= cmdDuplicate.Execute;

The above does not compile....
Thank you.

Marco


Brian Bushay TeamB

unread,
Jul 14, 2003, 7:19:01 PM7/14/03
to

> cant figure out how to get this nMyNewId back from the ADOCommand once
>executed.
>
>// Bund of SQL Statements....
>// ....
>nMyNewId:= cmdDuplicate.Execute;
cmdDuplicate.Execute;
nMyNewId := cmdDuplicate.paramaters.parambyName('@RETURN_VALUE').value;

--
Brian Bushay (TeamB)
Bbu...@NMPLS.com

Jari Kettunen

unread,
Jul 15, 2003, 1:12:22 AM7/15/03
to
"Marco Napoli" <ma...@avantitec.com> wrote in message
news:3f12f434$1...@newsgroups.borland.com...
nMyNewId:= cmdDuplicate.Execute is dropped on D7 and C6 but following code
seems to work.

procedure TForm1.Button1Click(Sender: TObject);
begin
ADOCommand1.CommandText:='Select max(id) from abc';
edit1.Text:=IntToStr(ADOCommand1.Execute.Fields[0].Value);
end;

Marco Napoli

unread,
Jul 15, 2003, 1:39:06 AM7/15/03
to
Thank you.

Marco


guihgo1...@gmail.com

unread,
Feb 6, 2014, 9:33:39 PM2/6/14
to
Hi ! For XE3 i have to use it:
---------
[CODE]
Edit1->Text = ADOCmd_fabri->Execute()->Fields->Item[0]->Value;
[/CODE]
---------
i use> Execute()->Fields->Item[0]->Value;
not> Execute()->Fields[0]->Value;
---------
For Delphianers: put . stead ->
---------

it's working for me...
0 new messages