title: MS SQL Server Update in C#
body: <p>Im trying to update a table in <code>C#</code> </p>
  
  <pre><code>int record_id = 123;    
  
  using (SqlConnection connection = new SqlConnection(sqlServer)) {
  
      SqlCommand mySqlCommand;
  
      string sql = "UPDATE my_table SET foo = @foo WHERE id = @id;";
  
      connection.Open();
  
      mySqlCommand = connection.CreateCommand();
      mySqlCommand.CommandText = sql;
  
      mySqlCommand.Parameters.Add("@foo", SqlDbType.VarChar, 50);
      mySqlCommand.Parameters["@foo"].Value = "bar";
  
      mySqlCommand.Parameters.Add("@id", SqlDbType.VarChar, 50);
      mySqlCommand.Parameters["@id"].Value = record_id;
  
      mySqlCommand.ExecuteNonQuery();
  
      connection.Close();
  }
  </code></pre>
  
  <p>When executed, I get a 500 server error with the following message:</p>
  
  <blockquote>
    <p>----- The page cannot be displayed because an internal server error has occurred.   Most likely causes:</p>
    
    <p>IIS received the request; however, an internal error occurred during
    the processing of the request. The root cause of this error depends on
    which module handles the request and what was happening in the worker
    process when this error occurred.</p>
    
    <p>IIS was not able to access the web.config file for the Web site or
    application. This can occur if the NTFS permissions are set
    incorrectly.</p>
    
    <p>IIS was not able to process configuration for the Web site or
    application.   The authenticated user does not have permission to use
    this DLL.</p>
    
    <p>The request is mapped to a managed handler but the .NET Extensibility</p>
    
    <h2>Feature is not installed.</h2>
  </blockquote>
  
  <p>Im not really a C#/.NET developer and not certain about the syntax here. I do know that the line <code>mySqlCommand.ExecuteNonQuery()</code> causes the error. </p>
  
  <p>There are also other SQL requests on the page (that I did not write) and they execute without issues. Unfortunately, none of them are <code>update</code> requests that I can use as an example. </p>