title: How to add plus one (+1) to a SQL Server column in a SQL Query
body: <p>The simple question is, how do you increment a field value in a MS Query by 1 ? I am trying to add 1 (+1) to an <code>int</code> column in my SQL Server database using a parametrized method. Similar to an i++ operation on a variable. I am using the following method:</p>
  
  <pre><code>public static int UpdateFieldCount(int parameterId)
  {
      // variable to hold the number of rows updated or the success of the query
      int updatesuccess = 0;
  
      // build your connection string
      string connectionstring = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
      SqlConnection conn = new SqlConnection(connectionstring);
  
      // build your SQL Query statement
      string SQLString = "UPDATE TableName SET TableField + 1 WHERE SomeFilterField = @ParameterID";        
      SqlCommand sqlcmd = new SqlCommand(SQLString, conn);
      sqlcmd.Parameters.AddWithValue("@ParameterID", parameterID);
  
      conn.Open();
      updatesuccess = sqlcmd.ExecuteNonQuery();
  
      conn.Close(); 
  
      return updatesuccess;
  }
  </code></pre>
  
  <p>This method is throwing the following error related to the plus sign (+) in my sql query:</p>
  
  <blockquote>
    <p>Incorrect syntax near '+'.</p>
    
    <p>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. </p>
    
    <p>Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near '+'.</p>
    
    <p>Source Error:    </p>
    
    <p>Line 315:<br>
    Line 316:        conn.Open();<br>
    Line 317:        updatesuccess = sqlcmd.ExecuteNonQuery();<br>
    Line 318:        conn.Close();<br>
    Line 319:</p>
    
    <p>Source File: c:\testdevlocation\appname\App_Code\ClassFileName.cs    Line: 317 </p>
  </blockquote>
  
  <p>Any advice on this?</p>