0
votes

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

1 Answers

1
votes

I have fixed it.

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