Esempio:
OdbcTransaction OT;
OT = MyConn.BeginTransaction();
try{
Stmt = MyConn.CreateCommand();
Stmt.CommandText = MySql.ToString();
Stmt.Transaction = OT;
Stmt.ExecuteNonQuery();
} catch(Exception SQLE) {
throw new Exception("Errore in spesa_ricorrente.insert(): " + SQLE.ToString());
}
// Prelievo dell'identity
try{
Stmt.CommandText="SELECT max(ID) FROM spesa_ricorrente";
ResSet = Stmt.ExecuteReader();
OT.Commit();
} catch(Exception SQLE) {
OT.Rollback();
throw new Exception("Errore in spesa_ricorrente.insert() durante la lettura dell'ID dell'oggetto." + SQLE.ToString());
}
[da 1 a 0 di 0 commenti] | Indietro