title: SQL UPDATE statement not working
body: <p>I am calling a static function to replace a value in .accdb file; to find a value of oldOA, then replace it with newOA.</p>
  <pre><code>    public static bool updateOA(string oldOA, string newOA)
      {
          ...
          command.Parameters.AddWithValue(&quot;@oldOA&quot;, oldOA);
          command.Parameters.AddWithValue(&quot;@newOA&quot;, newOA);
  
          command.CommandText = &quot;SELECT [OA_ID] FROM [Operating_Authority_Table] WHERE [OA_Name] = [@oldOA]&quot;;
          long value = long.Parse(command.ExecuteScalar().ToString());
          command.Parameters.AddWithValue(&quot;@OA_ID&quot;, value);
  
          command.CommandText = &quot;UPDATE [Operating_Authority_Table] SET [OA_Name] = [@newOA] WHERE [OA_ID] = &quot; + value;
  
          try
          {
              command.ExecuteNonQuery();
              message.show(1, &quot;&quot;, &quot;true&quot;);
              
              return true;
          }
          catch
          {
              message.show(1, &quot;&quot;, &quot;false&quot;);
              return false;
          }
      }
  </code></pre>
  <p>Initially i simply used:</p>
  <pre><code>    command.CommandText = &quot;UPDATE [OA_Table] SET [OA_Name] = [@newOA] WHERE [OA_Name] = [@oldOA]&quot;;
  </code></pre>
  <p>But i was told that I should get the OA_ID, which is the PK and update it from there, there resulting in the above code, but although the function still returns true, the value in the database still isn't updated..</p>
  <h1>EDIT</h1>
  <pre><code>command.CommandText = &quot;UPDATE [Operating_Authority_Table] SET [OA_Name] = @newOA WHERE [OA_Name] = @oldOA&quot;;
  </code></pre>
  <p>I updated to this statement already, though it still returns true, the value does not get updated. Am i making any syntax mistakes?</p>