Search found 3 matches

by puunnnk
11.09.2007, 13:01
Forum: MySQL
Topic: Problem with last inserted id.
Replies: 18
Views: 5910

Does it work if I insert it in a Timer????

For example every 1ms, I read the table and returns me the last id.
by puunnnk
04.09.2007, 18:13
Forum: MySQL
Topic: Problem with last inserted id.
Replies: 18
Views: 5910

I found out.

the is this:

Code: Select all

ZQuery1->Active=false;
ZQuery1->SQL->Clear();
ZQuery1->SQL->Add("SELECT max(id) as id FROM codigo");
ZQuery1->Active=true;
AnsiString lastid =  ZQuery1->FieldByName("id")->AsString;
Thanks for helping me.
by puunnnk
04.09.2007, 15:47
Forum: MySQL
Topic: Problem with last inserted id.
Replies: 18
Views: 5910

Problem with last inserted id.

I have this table: CREATE TABLE codigo (account_id INT NOT NULL DEFAULT 0, id INT NOT NULL AUTO_INCREMENT, Codigo INT, PRIMARY KEY (id), FOREIGN KEY (account_id) REFERENCES empresas(id) ON DELETE CASCADE ) And I want to select the last value(or the max id) and put it in an Edit. How do I select the ...