0

I want to check the checkbox in access using a query in C#.

I'm using DBSQL.

I've tried this :

string cmdStr = "UPDATE Workers SET Manager=@Manager WHERE ID=" + worker.Worker_ID;

        using (OleDbCommand command = new OleDbCommand(cmdStr))
        {
            command.Parameters.AddWithValue("@Manager", worker.Manager_IsAManager);
            base.ExecuteSimpleQuery(command);
        }
    }

but i got this error : "Data type mismatch in criteria expression"

I want to know how can i do this without getting this Exception ?

The field worker.Manager_IsAManager is a string , but in access is Yes/No.

i think this is the problem.

I don't want to change the data type in access to string.

1 Answer 1

1

I have fixed it.

i've changed the field to boolean (worker.Manager_IsAManager)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.