当前位置: 代码迷 >> Sql Server >> Access查询实施失败
  详细解决方案

Access查询实施失败

热度:60   发布时间:2016-04-24 23:03:21.0
Access查询执行失败
_RecordsetPtr rst;
sSQL.Format("Select * from ordertab where username='admin'");
rst = m_pConnection->Execute((_bstr_t)sSQL,NULL,adCmdText);
这样可以执行成功。

sSQL.Format("Select * from ordertab where StartTime>'2012-01-01'");
rst = m_pConnection->Execute((_bstr_t)sSQL,NULL,adCmdText);
这样执行不过。数据库为Access数据库,我在sql server中执行:
Select * from ordertab where StartTime>'2012-01-01'
是成功的。是为什么呢,格式有错误吗。StartTime为时间/日期字段。

------解决方案--------------------
如果没记错!
Access 日期好像要加 ##

Select * from ordertab where StartTime>#2012-01-01#
  相关解决方案