visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Databases :: MySql :: why LAST_INSERT_ID() returns 0 delphi


By: Nono Great Britain  Date: 11/04/2008 21:20:40  English  Points: 20 Status: Answered
Quality : Excellent
why LAST_INSERT_ID() returns 0 in delphi ?
By: VGR Date: 11/04/2008 21:23:59 English  Type : Answer
Well, I use Delphi too but I never found the various client library solutions to be ***that*** handy. Moreover, I prefer to code exclusively in PHP, included for console "DOS" applications (CLI)

In your case, expanding on This PAQ, I would recommend either :
- you call mysql_last_insert_id() in your API
- you query back using a discriminant ( a unique value you're pretty sure will return the exact same line which was inserted) and get the id
- (less reliable) you do the classical :

select id from yourtable order by id desc limit 1;




regards

Do register to be able to answer

EContact
browser fav
page generated in 291.453840 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page