首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

Access查询实施失败

2013-04-20 
Access查询执行失败_RecordsetPtr rstsSQL.Format(Select * from ordertab where usernameadmin)rs

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#

热点排行