title: save checkbox value in access database with vb.net 2010 (wpf c#)
body: <p>guy how can i insert the value of checkbox in access database or any database.</p>
  
  <p>i tried any of this sql statement but it still give me error: <strong>OleDbException was Unhandled. Data type mismatch in criteria expression.</strong> and it's pointing to myData = myCommand.ExecuteReader();</p>
  
  <p>note that allowviewpsr is a boolean type of field in ms access database or the one with YES/NO. :) chkviewpsr is mycheckbox</p>
  
  <pre><code>SQL = "UPDATE `RUsers` SET `allowviewpsr` = '" + chkviewpsr.IsChecked.Value + "' WHERE `idnum`= '" + txtblkuserid.Text  + "' AND `fullname`= '" + txtblkusername.Text + "'";
  </code></pre>
  
  <p>also this:</p>
  
  <pre><code>SQL = "UPDATE `RUsers` SET `allowviewpsr` = '" + chkviewpsr.IsChecked + "' WHERE `idnum`= '" + txtblkuserid.Text  + "' AND `fullname`= '" + txtblkusername.Text + "'";
  </code></pre>
  
  <p>and also this:</p>
  
  <pre><code>SQL = "UPDATE `RUsers` SET `allowviewpsr` = '" + chkviewpsr + "' WHERE `idnum`= '" + txtblkuserid.Text  + "' AND `fullname`= '" + txtblkusername.Text + "'";
  </code></pre>
  
  <p>and here's my connector:</p>
  
  <pre><code>myCommand.CommandText = SQL;
  myCommand.Connection = MyNewOleDbConnection;
  myAdapter.SelectCommand = myCommand;
  myData = myCommand.ExecuteReader();
  </code></pre>
  
  <p><strong>EDITED:</strong>
  hi anandkumar thanks for the quick replay i tried NonQuery but it gives same error as above</p>
  
  <pre><code>SQL = "UPDATE `RWMUsers` SET `allowviewpsr` = '" + chkviewpsr.IsChecked.Value + "' WHERE `idnum`= '" + txtblkuserid.Text  + "' AND `fullname`= '" + txtblkusername.Text + "'";
  myCommand.CommandText = SQL;
  myCommand.Connection = MyNewOleDbConnection;
  myAdapter.UpdateCommand = myCommand;
  myCommand.ExecuteNonQuery();
  </code></pre>
  
  <p><strong>Snapshot of my Access Database</strong> :(</p>
  
  <p><img src="https://i.stack.imgur.com/3fq3E.png" alt="enter image description here"></p>