Beispiel #1
0
 private bool ExecuteBatch(string batch, uint count)
 {
     if (String.IsNullOrEmpty(batch))
     {
         return(true);
     }
     while (count > 0)
     {
         if (null != Executing)
         {
             var args = new SqlCmdExecutingEventArgs(
                 Environment, batch);
             Executing(this, args);
         }
         var cmd = new SqlCommand(batch, Environment.Connection);
         cmd.CommandTimeout = 0;
         try {
             LastBatch = batch;
             cmd.ExecuteNonQuery();
         } catch (SqlException sqlex) {
             LastException = sqlex;
             if (false == ContinueOnError)
             {
                 return(false);
             }
         }
         --count;
     }
     return(true);
 }
Beispiel #2
0
		private bool ExecuteBatch (string batch, uint count) {
			if (String.IsNullOrEmpty (batch)) {
				return true;
			}
			while (count > 0) {
				if (null != Executing) {
					var args = new SqlCmdExecutingEventArgs (
						Environment, batch);
					Executing (this, args);
				}
				var cmd = new SqlCommand (batch, Environment.Connection);
				cmd.CommandTimeout = 0;
				try {
					LastBatch = batch;
					cmd.ExecuteNonQuery ();
				} catch (SqlException sqlex) {
					LastException = sqlex;
					if (false == ContinueOnError) {
						return false;
					}
				}
				--count;
			}
			return true;
		}