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

We now celebrate our 5 years of existence and break our frequentation records... Here are the stats of those 5 years.

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

 Add This Article To:
 del.icio.usDel.icio.us  diggDigg  googleGoogle  spurlSpurl
 blinkBlink  wongWong  simpySimpy  yahooY! MyWeb 
EContact
browser fav
page generated in 4549.268010 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page