title: CLR Stored Procedure with C# throwing errors
body: <p>Hi I am working on making a CLR stored procedure using C#, for which I am learning through examples.</p>
  
  <p>Below is what I am trying now </p>
  
  <pre><code>public static void GetProductsByPrice(int price)
  {
      SqlConnection connection = new SqlConnection("context connection=true");
      connection.Open();
  
      string commandText = "SELECT * FROM Products WHERE PRICE &lt; " + price.ToString();
  
      SqlCommand command = new SqlCommand(commandText, connection);
      SqlDataReader reader = command.ExecuteReader();
  
      // Create the record and specify the metadata for the columns.
      SqlDataRecord record = new SqlDataRecord(
          new SqlMetaData("col1", SqlDbType.NVarChar, 100),
          new SqlMetaData("col2", SqlDbType.NVarChar, 100));
  
      // Mark the begining of the result-set.
      SqlContext.Pipe.SendResultsStart(record);
  
      // Send 10 rows back to the client. 
      while (reader.Read())
      {
          // Set values for each column in the row.
          record.SetString(0, reader[1].ToString()); //productName
          record.SetString(1, reader[2].ToString()); // productDescription
          // Send the row back to the client.
          SqlContext.Pipe.SendResultsRow(record);
      }
  
      // Mark the end of the result-set.
      SqlContext.Pipe.SendResultsEnd();
  }
  </code></pre>
  
  <p>But when I try to run it I get the below errors</p>
  
  <blockquote>
    <p><em>Msg 6549, Level 16, State 1, Procedure GetProductsByPrice, Line 0<br>
    A .NET Framework error occurred during execution of user defined routine or aggregate 'GetProductsByPrice':<br>
    System.Data.SqlClient.SqlException: The locale identifier (LCID) 16393 is not supported by SQL Server.<br>
    System.Data.SqlClient.SqlException:<br>
    at Microsoft.SqlServer.Server.SmiEventSink_Default.DispatchMessages(Boolean ignoreNonFatalMessages)<br>
    at Microsoft.SqlServer.Server.SqlPipe.SendResultsStart(SqlDataRecord record)<br>
    at StoredProcedures.GetProductsByPrice(Int32 price)<br>
    User transaction, if any, will be rolled back.</em></p>
  </blockquote>
  
  <p>I am referring to this <a href="http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.server.sqlpipe.sendresultsstart.aspx" rel="nofollow">msdn article</a> for the code.</p>
  
  <p>Please help me out on this.</p>