title: ADO.NET Batch Insert with over 2000 parameters
body: <p>I'm using Enterprise library, but the idea is the same. I have a  SqlStringCommand and the sql</p>
  
  <p>is constructed using StringBuilder in the forms of</p>
  
  <pre><code>"insert into table (column1, column2, column3) values (@param1-X, @param2-X, @parm3-X)"+" " 
  </code></pre>
  
  <p>where "X" represents a "for loop" about 700 rows</p>
  
  <pre><code>StringBuilder sb = new StringBuilder();
  for(int i=0; i&lt;700; i++)
  {
     sb.Append("insert into table (column1, column2, column3) values (@param1-"+i+", @param2-"+i, +",@parm3-"+i+") " );
  }
  </code></pre>
  
  <p>followed by constructing a command object injecting all the parameters w/ values into it. </p>
  
  <p>Essentially, 700 rows with 3 parameters, I ended up with 2100 parameters for this "one sql" Statement. </p>
  
  <p>It ran fine for about a few days and suddenly I got this error</p>
  
  <pre><code>===============================================================
  
  A severe error occurred on the current command. The results, if any, should be discarded.
  
  at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) 
  at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) 
  at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) 
  at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) 
  at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) 
  at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) 
  at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) 
  at System.Data.SqlClient.SqlCommand.InternalExecuteNon
  </code></pre>
  
  <p>Any pointers are greatly appreciated. </p>