MySQL ID вставленного ряда
-- For mysql
INSERT INTO table_name (col1, col2,...) VALUES ('val1', 'val2'...);
SELECT LAST_INSERT_ID();
Caleb McNevin
-- For mysql
INSERT INTO table_name (col1, col2,...) VALUES ('val1', 'val2'...);
SELECT LAST_INSERT_ID();
SELECT MAX(id) AS last_id FROM users
-- last_id --
-- 33 --
-- To get the last inserted auto-increment row ID: --
SELECT LAST_INSERT_ID( optional_expression )
-- If you have just inserted it using a command in C# use: --
int lastId = (Int32)yourCommand.LastInsertedId;
mysql> select *from LastInsertedRow where Id=(SELECT LAST_INSERT_ID());