Return Last ID (IDENTITY) On Insert row VB.NET MySQL
You can use an double Query and use the function LAST_INSERT_ID() After run your first query to get the last current query:
Dim insert_coupon_query As String = ("INSERT INTO qa_discountcoupons (status_code) VALUES (5); SELECT LAST_INSERT_ID()")
Dim cmd_query As New MySqlCommand(insert_coupon_query, objConn)
Dim cmd_result As Integer = CInt(cmd_query.ExecuteScalar())
MsgBox(cmd_result)
Bit late to the party but after
cmd_query.ExecuteScalar()
MsgBox(cmd_query.LastInsertedId)
Produces the last insert id.
You can fetch the AUTO_INCREMENT value for a table through a MySQL query and then show that in your MsgBox