I need to grab the last inserted id of a row I'm inserting into a dataset (using the MySQL C#/Connector). I update the database with a mysqldataadapter but I can't find a way to grab the last insert id once the row is commited to the database.
I looked into the debugger and it shows the primary key of the row inserted as {} (in other words null). I don't really want to have to call yet another mysql command to grab it as it will slow everything down I would think. What are my options?
Question
sathenzar
I need to grab the last inserted id of a row I'm inserting into a dataset (using the MySQL C#/Connector). I update the database with a mysqldataadapter but I can't find a way to grab the last insert id once the row is commited to the database.
I looked into the debugger and it shows the primary key of the row inserted as {} (in other words null). I don't really want to have to call yet another mysql command to grab it as it will slow everything down I would think. What are my options?
Link to comment
https://www.neowin.net/forum/topic/1010442-cmysql-getting-the-last-insert-id-after-commit/Share on other sites
5 answers to this question
Recommended Posts