bonjour ! j'ai un doute sur l'utilisation des transaction en vb.net voila mon petit bout de code !! suis je dans l'erreur ? (je veux etre sur que toute mes requete parte sinon aucune)
mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 'la connexion est deja ouverte Try dim command as New OleDb.OleDbCommand dim trans as OleDb.OleDbTransaction trans.Begin() command.CommandText = "delete from [matable] where [macolone] in(select [macolone2] from [matable2] where [macolone2]<>0)" command.ExecuteNonQuery() command.CommandText = "delete from [matable] where [macolone] in(select [macolone2] from [matable2] where [macolone2]<>0)" command.ExecuteNonQuery() command.CommandText = "delete from [matable] where [macolone] in(select [macolone2] from [matable2] where [macolone2]<>0)" command.ExecuteNonQuery() trans.Commit() Catch ex As Exception trans.Rollback() Finally connection.Close() End Try
Partager