Anda dapat menggunakan Query ganda dan menggunakan fungsi LAST_INSERT_ID() Setelah menjalankan kueri pertama Anda untuk mendapatkan kueri terakhir saat ini:
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)