dygj
asked on
Delphi 2005 BDP get scope_identity()
Delphi 2005, mssql server 8 Asp .net application
I need to get the new identity value returned after doing an insert into.
Statement are:
bdpcommand_insert.commandt ext='Inser t into mytable (myfield1,myfield2) values (?,?)'
bdpcommand_getid.commandte xt='select scop_identity() as ID'
bdpcommand_insert.paramete rs[0]:=tex tbox1;
bdpcommand_insert.paramete rs[1]:=tex tbox2;
Mybdpconenction.open;
trans:mybdpconnection.begi ntransacti on;
bdpcommand_insert.executeN onQuery;
myid=integer(bdpcommand_ge tid.execut escalar);
trans.commit;
But I only get 0 as myid, ie the new identity value is not returned.
Any hints how to get the identity of a insert into statement?
(I figured it out how to do it if you insert a new record into a grid reading an article
www.howtodothings.com/ViewArticke.aspx?Article)762 , but now I am inserting one records from a web form)
I also tried with the following statement without results:
aread=bdpcommand_getid.exe cutereader ;
while aread.read do
myid=aread['id'].tostring;
I need to get the new identity value returned after doing an insert into.
Statement are:
bdpcommand_insert.commandt
bdpcommand_getid.commandte
bdpcommand_insert.paramete
bdpcommand_insert.paramete
Mybdpconenction.open;
trans:mybdpconnection.begi
bdpcommand_insert.executeN
myid=integer(bdpcommand_ge
trans.commit;
But I only get 0 as myid, ie the new identity value is not returned.
Any hints how to get the identity of a insert into statement?
(I figured it out how to do it if you insert a new record into a grid reading an article
www.howtodothings.com/ViewArticke.aspx?Article)762 , but now I am inserting one records from a web form)
I also tried with the following statement without results:
aread=bdpcommand_getid.exe
while aread.read do
myid=aread['id'].tostring;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Anyway some more bugs found in delphi
- cut/past/print will not work anymore if you save desctop settings.
- after using the depoy manager all form designs are invisible.
- renaming a form with visual objects will crash most things.
- depoying an asp application with upgrade 3 is only possibile with many manuall changes.
(http://www.drbob42.com/examines/examin66.htm)