title: C# - batch execute stored procedures
body: <p>I currently have a WinForms application written using C#. </p>
  
  <p>All our updates are done through executing stored procedures. We have a situation on one screen where there are up to 60 updates called on that screen. At the moment each update call is processed one by one, and some clients who have slow connectivity between the client and the server are experiencing speed issues. I'm pretty sure that if I can send all these calls to the database at once, that it would save a lot of wait time on the client side (currently for each of those 60 calls, ExecuteNonQuery is called and the client waits for a true / false result before continuing and this is causing a delay). </p>
  
  <p>What would be the best way to bundle all these calls into one SQL call? Was thinking of putting all the code into a transaction but need to avoid locks as much as possible as there are many concurrent users using the system at any given point.</p>
  
  <p>EDIT: The purpose of the stored procs is literally to update records on the server. We don't even require any response from the stored procs that are being executed. In essence, I want to bundle a bunch of calls the code below into one call and wondering what the best way to do so is</p>
  
  <pre><code>        public virtual bool Update(DataRow dataRow, Guid userId)
      {
          SqlCommand cm = null;
          bool ret = true;
          try
          {
              cm = Utilities.GetSqlUpdateCommand(dataRow, userId);
              ExecuteNonQuery(cm);              
          }
          catch (SqlException ex)
          {
              LogDataAccessBaseError(ex);
              ret = false;
              throw;
          }
          finally
          {
              if (cm != null)
              {
                  cm.Dispose();
              }
          }
  
          return ret;
      }
  </code></pre>