c# - whats the right version for using either scope_identity() ,@@identity (),last_insert_id() in mysql -
im working on asp.net c# ,i tried 3 of them none worked , sql error(you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'select last_insert_id()') query:
string st = ("insert `service` values ('','" + noms + "','" + desc + "','3','" + ad + "','" + vil + "','" + pays + "')"+" select scope_identity()");
you can use lastinsertedid
property of mysqlcommand
:
// cmd mysqlcommand objet cmd.executenonquery(); long lastinsertedid = cmd.lastinsertedid;
Comments
Post a Comment