i'm using EF6 to insert rows in database Mysql 8.0.26 . I've changed a column in table, after that I'm not update model in edmx . So when I try to add a new row and SaveChanges(), the save change go in error using a try and catch, but auto_increment of table increase. Someone know to understand how it can't increase auto_increment if the row can't insert : This is the example of code :
Using e As New studio_laghezzaEntities4
Try
Dim newfasccons As New fasciconsulenza With {
.Openbyuser = idUser,
.FKcustomer = cons.CodiceCliente,
.Opendate = Date.Now,
.LastUpdateDate = Date.Now,
.LastUserUpdate = idUser,
.Praticacons = cons.CodiceFascicolo,
.Esercente = fasc.Esercente
}
e.fasciconsulenza.Add(newfasccons)
e.SaveChanges()
Dim newcons As New consulenza With {
.ProspettoOre = fasc.ProspettoOreLavoro,
.NoteConsulenza = fasc.AreaDescrittiva,
.FKuser = idUser,
.FKfasc = newfasccons.IdDoc,
.FKInterv = idtipointevento,
.DataCreazione = Date.Now
}
e.consulenza.Add(newcons)
e.SaveChanges()
Dim newconsinassoc As New consofsales With {
.FK_fasc = insertIddoc,
.FK_oursales = idsaler
}
e.consofsales.Add(newconsinassoc)
e.SaveChanges()
Catch ex As Exception
esito.inserito = False
esito.message = ex.Message
End Try
End Using