简体   繁体   中英

Data type mismatch in criteria expression for Access AutoNumber

RentReturnCommand.CommandText = "update CustomerOrder set Status = '" &_ OrderStatusComboBox.Text & "' WHERE  CID = " & CIDTextBox.Text & "  AND CompID = " &_ CompIDText.Text

RentReturnCommand.ExecuteNonQuery()

RentReturnCommand.ExecuteNonQuery() constantly shows up as the error.

I've looked up all possible solutions to change this, but nothing works. My CID is listed in Access Database as an AutoNumber.

I know AutoNumber tends to cause a problem with this type of SQL involved, but I really need to query that in my program.

If I type "fred" in your textbox, this error will take place. Two things that will help you are validating all user input and using query parameters.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM