title: Update statement is not working in SQL Server 2014 using c#
body: <p>I am using SQL server 2014. I can access the data and show in the ASP. net application. But I am not able to update the data.</p>
  
  <pre><code>using(SqlConnection cn1 = new SqlConnection(ConfigurationManager.ConnectionStrings["WebTeamServersConnectionString"].ConnectionString))
  {
      string[] words1 = fields.Split(',');
      string sql = "UPDATE [Web Team Servers] SET ";
      foreach (string s1 in words1)
      {
          if (ct1 == 1)
          {
              sql = sql + s1 + " = '@Param" + ct1 + "'";
          }
          else
          {
              sql = sql + ", " + s1 + " = '@Param" + ct1 + "'";
          }
          ct1 = ct1 + 1;
      }
      sql = sql + " WHERE Server = '@Server'";
      SqlCommand cmd = new SqlCommand(sql,cn1);
  
      cmd.Parameters.AddWithValue("@Server", strServer);
      string[] words = values.Split(',');
  
      foreach (string s in words)
      {
          string param = "@param" + ct;
          cmd.Parameters.AddWithValue(param, s);
          ct = ct + 1;
      }
      cmd.CommandType = CommandType.Text;
      try
      {
          cn1.Open();
          int rows = cmd.ExecuteNonQuery();
      }
      catch (Exception ex)
      {
      }
      finally
      {
          cn1.Close();
      }
  }
  </code></pre>