Microsoft Access中的SQL Update错误 [英] SQL Update Error in Microsoft Access
本文介绍了Microsoft Access中的SQL Update错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用VB6创建一个抽奖计划。
我在更新数据时遇到问题MDB。执行SQL时这是错误
条件表达式中的数据类型不匹配。
Hi,
I''m creating a Raffle Program using VB6.
I''m having trouble updating the data in MDB. This is the error when executing the SQL
Data type mismatch in criteria expression.
UPDATE WINNERS SET PrizeClaimed='1' WHERE RaffleNumber=461 AND [Date]='11/21/2012 11:12:52 PM';
这是我在添加记录时使用的查询。不知道为什么上面的SQL不会运行。我只是使用相同的日期添加记录''11/21/2012 11:12:52 PM''
This is the query I use in adding the record. Don''t know why the above SQL won''t run. I just add record using the same dates ''11/21/2012 11:12:52 PM''
INSERT INTO WINNERS([RaffleNumber], [PrizeClaimed], [Date]) VALUES('461', '0', '11/21/2012 11:12:52 PM');
任何人都可以发布为什么会发生这种情况......
谢谢
Can anyone post why this happens...
Thanks
推荐答案
I尝试实验
我使用这个#
并且它可以工作
I try experimenting
I use this#
and it works
UPDATE WINNERS SET PrizeClaimed='1' WHERE RaffleNumber=461 AND [Date]=#11/21/2012 11:12:52 PM#;
看来您的INSERT语句的值为字符串,而UPDATE为Raffle Number是一个数字,
尝试
It appears your INSERT statement has the values as strings, and the UPDATE as Raffle Number is a number,
Try
UPDATE WINNERS SET PrizeClaimed='1' WHERE RaffleNumber='461' AND [Date]='11/21/2012 11:12:52 PM';
看看是否有帮助。
See if that helps.
使用日期时始终使用#
例如#21/03/2012#
Always use # when using dates.
eg #21/03/2012#
这篇关于Microsoft Access中的SQL Update错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文