title: SQL Server Bulk Insert failing when called from .NET SqlCommand
body: <p>I have a stored procedure which does bulk insert on a SQL server 2005 database.
  When I call this stored procedure from some SQL (passing in the name of a local format file and data file) it works fine. Every time.</p>
  
  <p>However, when this same stored procedure gets called from C# .NET 3.5 code using <code>SqlCommand.ExecuteNonQuery</code> it works intermittently.</p>
  
  <p>When it fails a <code>SqlException</code> is generated stating:</p>
  
  <blockquote>
    <p>Cannot bulk load. Invalid column number in the format file "c:\bulkinsert\MyFile.fmt"</p>
  </blockquote>
  
  <p>I don't think this error message is correct. </p>
  
  <p>Has anyone experienced similar problems with calling bulk insert from code?</p>
  
  <p>Thanks.</p>