[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-win32
Subject:    Re: Delphi and mySQL AUTOINCREMENT
From:       "Petr Vileta" <petr () practisoft ! cz>
Date:       2004-07-23 1:00:50
Message-ID: 004801c47052$7fdf8240$6401a8c0 () ns
[Download RAW message or body]

> I am using Delphi 5 and 7.  When I post a new record into a table which
> is keyed on an autoincrement field I do not get a result set back telling
> me the number the server has allocated to the record.
>
> I am using a TQuery component to execute the SQL statement.  Are there any
> way to retrieve the result set back on posting?  I have checked all
associated
> properties, methods and events etc... but nothing seems to work.
Immediately after insert you must to run query

SELECT last_insert_id();

and read result. But remeber that the value is valid IMMEDIATE after insert
only, before other query.

Petr Vileta, Czech republic


-- 
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe:    http://lists.mysql.com/win32?unsub=mysql-win32@progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic