public Object MultipleExecInTran(SQLExecInfo[] ListInfo, int IndexResultat = 0) { if (ListInfo.Length <= 0 || ListInfo.Length < IndexResultat) throw (new Exception("Erreur Argument MultipleExecInTran. SQLInfo vide ou trop petit par rapport à IndexResultat")); int i; InitCommand(); object MonResultat = null; IDbTransaction MyTran = MyConn.BeginTransaction(); myAccessCommand.Transaction = MyTran; try { for (i = 0; i < ListInfo.Length; i++) { if (ListInfo[i].mesArgs != null) { FillParameters(ListInfo[i].mesArgs); } myAccessCommand.CommandText = ListInfo[i].strSQL; if (i == IndexResultat) { MonResultat = myAccessCommand.ExecuteScalar(); } else { myAccessCommand.ExecuteNonQuery(); } }// end for MyTran.Commit(); MyConn.Dispose(); return MonResultat; } catch (Exception ex) { MyTran.Rollback(); MyConn.Dispose(); throw ex; } }// end MultipleExecInTran
public void ExecuteQueryWithArgs(SQLExecInfo MesInfos) { ExecuteQueryWithArgs(MesInfos.strSQL, MesInfos.mesArgs); }// end SQL_Execute