我想根据是/否字段更新我的访问数据库。 我想要使用的字符串是:
sqlstr = "UPDATE [Reactie] SET DoubleCheck = '1' WHERE Online = '0'"
当我使用它时,我收到以下错误:
"System.Data.OleDb.OleDbException (0x80040E07): Data type mismatch in criteria expression. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at Brady_Check_In_Out.Database.reactie(String sector, String type, String checked)"
当我删除WHERE部分,或想要更新另一个字段时,如:
sqlstr = "UPDATE [Reactie] SET DoubleCheck = '1' WHERE Sector = 'MG'"
然后它完美无缺。
任何想法为什么? 顺便说一句,我也尝试过:WHERE Online ='False',但没有运气。
答案 0 :(得分:1)
如果“在线”是布尔值:
sqlstr =“UPDATE [Reactie] SET DoubleCheck ='1'WHERE Online = 0”