access 日期字段 update时不对

xztslsz 2008-10-28 08:02:33
现在又出现一个问题,就是在修改记录进行更新时,出错了,语句如下:
string sSQL = "update buy set 进货日期='"+buydateTimePicker.Value.ToString("yyyy-MM-dd")+"', set 进货店='"+buyshoptextBox.Text+"' where 编号="+IDhao;
在语句处cmdresults = OleDbCommand1.ExecuteNonQuery();出现绿色。
若把更新日期的字段去掉,正常。如下:
string sSQL = "update buy set 进货店='"+buyshoptextBox.Text+"' where 编号="+IDhao;
为什么呢?
...全文
70 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
xztslsz 2008-10-28
  • 打赏
  • 举报
回复
刚才网不能上,我自己解决了,是set的问题。
fangma2001 2008-10-28
  • 打赏
  • 举报
回复
string sSQL = "update buy set 进货日期=#2008-10-30#, 进货店='"+buyshoptextBox.Text+"' where 编号="+IDhao;

去掉第二个set才行。
csrwgs 2008-10-28
  • 打赏
  • 举报
回复
估计你把 编号 去掉也可以
xztslsz 2008-10-28
  • 打赏
  • 举报
回复
我用下面这样固定的格式也不对:
string sSQL = "update buy set 进货日期=#2008-10-30#, set 进货店='"+buyshoptextBox.Text+"' where 编号="+IDhao;
用下面的语句也不对:
string sSQL = "update buy set 进货日期='2008-10-30', set 进货店='"+buyshoptextBox.Text+"' where 编号="+IDhao;

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧