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

List:       kde-devel
Subject:    Re: SQL with QT - getting ID from insert-query with auto_increment
From:       Pascal Francq <pfrancq () ulb ! ac ! be>
Date:       2002-01-31 10:08:03
[Download RAW message or body]

On Thursday 31 January 2002 07:05, Markus Oley wrote:
> Hi,
>
> I want to create a dialogbox with an QListView and some QLineEdits. The
> data that is given in the QLineEdits must be stored in a mySQL - database.
> Now I have the problem that the ID of new data should be automatically
> created by the database. I solved this with the following QSqlQuery:
>
>                INSERT INTO table .......
>
> How do I get the ID that SQL gets for the new data to apply the
> QListView???
>
> Thanx for every solution given
>
> Markus
>
> >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to
> >> unsubscribe <<

SELECT LAST_INSERT_ID() FROM table where id=LAST_INSERT_ID();
-- 


Ir Pascal Francq
Researcher
Université Libre de Bruxelles
CAD/CAM Department
Avenue F.D. Roosevelt, 50
CP 165/14
B-1050 Brussels
BELGIUM
Tel. +32-2-650 47 65
Fax +32-2-650 47 24
ICQ: 91206668

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

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