return key after inserting row

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
AceEmbler
Posts: 26
Joined: Fri 04 Aug 2006 09:45

return key after inserting row

Post by AceEmbler » Tue 22 Aug 2006 11:15

Is MySqlDirect .NET provides any way to retrive primary key of just inserted row ?? If not can you please tell me best way of doing this "manually" ?

Best Regards.

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Tue 22 Aug 2006 11:53

There are several ways to do it:
  • Use MySqlCommand.InsertId property.
    Execute SELECT last_insert_id() statement.

Post Reply