简单SQL命令解决思路
简单SQL命令
COleDateTime nTime;
nTime = COleDateTime::GetCurrentTime();
CString str;
str = nTime.Format( "%Y-%m-%d %H:%M:%S ");
CString strSQL;
strSQL.Format( "INSERT INTO Report(Time) Values( '+%s+ ') ",str);
g_pConnection-> Execute((_bstr_t)(LPCTSTR)strSQL,
NULL, adCmdUnknown);
结果报错? Time 是设定好的时间格式,就是ACCESS下设计好的.
除了Time 还有其他一些字段.
SQL语句错在哪里?
------解决方案--------------------
INSERT INTO R([Time]) Values( '2005-2-2 10:00:00 ')
DATATIME
------解决方案--------------------
这跟格式有什么问题? 是字段名的问题。。
------解决方案--------------------
Time,数据库保留字,用作字段名要加 []
COleDateTime nTime;
nTime = COleDateTime::GetCurrentTime();
CString str;
str = nTime.Format( "%Y-%m-%d %H:%M:%S ");
CString strSQL;
strSQL.Format( "INSERT INTO Report(Time) Values( '+%s+ ') ",str);
g_pConnection-> Execute((_bstr_t)(LPCTSTR)strSQL,
NULL, adCmdUnknown);
结果报错? Time 是设定好的时间格式,就是ACCESS下设计好的.
除了Time 还有其他一些字段.
SQL语句错在哪里?
------解决方案--------------------
INSERT INTO R([Time]) Values( '2005-2-2 10:00:00 ')
DATATIME
------解决方案--------------------
这跟格式有什么问题? 是字段名的问题。。
------解决方案--------------------
Time,数据库保留字,用作字段名要加 []