日期:2014-05-19  浏览次数:20437 次

一个难缠的SQL语句时间更新问题,望高手帮忙
更新句是: "update   表名   set   enter_time=# "+DateTime.Now+ "#   where   id= "+id
在sql数据库中enter_time字段型为datetime;
本人在更新语句时错误提示是: '14 '   附近有语法错误。
注:vs2005调试:当时时间是:Now   =   {2007-4-16   14:26:05}  
如果时间变化了2007-4-16   hh:mm:ss,错误提示也跟着其中的hh(小时)变化着.

小弟不解,也尝试了种时间转化问题,还是未能解决,望各位出手帮助,谢谢!!




------解决方案--------------------
Access中是:
: "update 表名 set enter_time=# "+DateTime.Now+ "# where id= "+id
Sql Server中应该改成:
"update 表名 set enter_time= ' "+DateTime.Now+ " ' where id= "+id