title: C# OleDB Update statement not updating
body: <p>I'm trying to update an Access database through my C# web application but I'm currently facing a problem in WHERE statement not updating the records and not returning any errors.  </p>
  
  <p>I'm trying update a text field and the condition in my WHERE statement is an integer.</p>
  
  <pre><code>        OleDbCommand cmd = new OleDbCommand("UPDATE Data SET Title = @Title WHERE ID = @ID");
          cmd.CommandType = CommandType.Text;
          cmd.Connection = conn;
          cmd.Parameters.AddWithValue("@Title", TextBox1.Text);
          cmd.Parameters.AddWithValue("@ID", param2);
  </code></pre>
  
  <p>I even tried doing it this way  </p>
  
  <pre><code>        OleDbCommand cmd = new OleDbCommand("UPDATE Data SET Title = ? WHERE ID = ?");
          cmd.CommandType = CommandType.Text;
          cmd.Connection = conn;
          cmd.Parameters.AddWithValue("?", TextBox1.Text);
          cmd.Parameters.AddWithValue("?", param2);
  </code></pre>
  
  <p>But it's still not updating!<br>
  What I found out trying to fix it is that when i replace the first parameter with a string between single quotes (see below), it actually updates the table.  </p>
  
  <pre><code>OleDbCommand cmd = new OleDbCommand("UPDATE Data SET Title = 'test' WHERE ID = @ID");
  </code></pre>
  
  <p>Does any of you guys have an idea why is this happening?  </p>
  
  <p>Edit: This is the full code  </p>
  
  <pre><code>    using (OleDbConnection conn = new OleDbConnection(connectionString))
      {
          OleDbCommand cmd = new OleDbCommand("UPDATE Data SET Title = @Title WHERE ID = @ID");
          cmd.CommandType = CommandType.Text;
          cmd.Connection = conn;
          cmd.Parameters.AddWithValue("@Title", TextBox1.Text);
          cmd.Parameters.AddWithValue("@ID", param2);
          conn.Open();
          try
          {
              cmd.ExecuteNonQuery();
          }
          catch (Exception ex)
          {
              Response.Write(ex.Message);
  
          }
  </code></pre>
  
  <p>Edit 2:<br>
  This is my code after trying to set the data types, it's still not working.<br>
  To clarify, in my Access database ID is "AutoNumber" and Title is "Long Text"</p>
  
  <pre><code>    using (OleDbConnection conn = new OleDbConnection(connectionString))
      {
          OleDbCommand cmd = new OleDbCommand("UPDATE Data SET Title = ? WHERE ID = ?");
          cmd.CommandType = CommandType.Text;
          cmd.Connection = conn;
          cmd.Parameters.AddWithValue("Title", TextBox1.Text).OleDbType = OleDbType.VarChar;
          cmd.Parameters.AddWithValue("ID", param2).OleDbType = OleDbType.Integer;
          conn.Open();
          try
          {
              var recordsUpdated = cmd.ExecuteNonQuery();
          }
          catch (Exception ex)
          {
              Response.Write(ex.Message);
          }
  </code></pre>
  
  <p>When I check the value of recordsUpdated, it returns "1" but the database isn't being updated.</p>