Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8768505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:05:08+00:00 2026-06-13T17:05:08+00:00

guy how can i insert the value of checkbox in access database or any

  • 0

guy how can i insert the value of checkbox in access database or any database.

i tried any of this sql statement but it still give me error: OleDbException was Unhandled. Data type mismatch in criteria expression. and it’s pointing to myData = myCommand.ExecuteReader();

note that allowviewpsr is a boolean type of field in ms access database or the one with YES/NO. 🙂 chkviewpsr is mycheckbox

SQL = "UPDATE `RUsers` SET `allowviewpsr` = '" + chkviewpsr.IsChecked.Value + "' WHERE `idnum`= '" + txtblkuserid.Text  + "' AND `fullname`= '" + txtblkusername.Text + "'";

also this:

SQL = "UPDATE `RUsers` SET `allowviewpsr` = '" + chkviewpsr.IsChecked + "' WHERE `idnum`= '" + txtblkuserid.Text  + "' AND `fullname`= '" + txtblkusername.Text + "'";

and also this:

SQL = "UPDATE `RUsers` SET `allowviewpsr` = '" + chkviewpsr + "' WHERE `idnum`= '" + txtblkuserid.Text  + "' AND `fullname`= '" + txtblkusername.Text + "'";

and here’s my connector:

myCommand.CommandText = SQL;
myCommand.Connection = MyNewOleDbConnection;
myAdapter.SelectCommand = myCommand;
myData = myCommand.ExecuteReader();

EDITED:
hi anandkumar thanks for the quick replay i tried NonQuery but it gives same error as above

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();

Snapshot of my Access Database 🙁

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:05:10+00:00Added an answer on June 13, 2026 at 5:05 pm

    Instead of

    myAdapter.SelectCommand = myCommand;
    myCommand.ExecuteReader(); 
    

    Use

    myAdapter.UpdateCommand = myCommand;
    myCommand.ExecuteNonQuery();
    

    Reference:

    http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldataadapter.updatecommand.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a hard time finding this answer so I'm hoping you guy can
I've read Romain Guy's post on the <merge /> tag, but I still don't
Can't remember where I read it, but I remember a MS guy saying that
If anyone can get this guy's small bit of code working on their machine,
You can give someone an url with get: http://myserver.com/?var=val But what to do with
Possible Duplicate: Source Control for a .Net guy Can any one help me to
Guy, I am in need for a functionality which can take Zipcode as an
I've been banging my head...I can't pretend to be a C++ guy... TCHAR *
I am a CS guy getting started with Arduino. This is probably a very
Help a guy out. Can't seem to get a decorator to work with inheritance.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.