I need to insert a row in asp-classic and mysql and get his unique id. Here is my code:
sql = "insert into o_operaciones (idoperacion, fechaalta, nombre)"
sql = sql & ") VALUES ("
sql = sql & "DEFAULT,now(),'" & nombre & "');"
sql = sql & "SELECT max(idoperacion) as id from o_operaciones; "
Set rsInsert = Conex.Execute(sql)
idoperacion = cdbl(rsInsert("id"))
With this code i don´t have errors but the recordset it´s empty or closed after execute.
I know there is another ways to do the same, but i think this is the faster.
I tried SET NOCOUNT
but don't work in MySql.