我在做一个ADO查询链接。具体SQL语句是这样的
select car_id,pass_log.RFID,pass_time,pass_type from pass_log,rfid_cardinfo
where pass_time
between
to_date('0011-3-10 17:20:00','YYYY-MM-DD HH24:MI:SS') and
to_date('0011-6-10 17:20:00','YYYY-MM-DD HH24:MI:SS') and pass_log.rfid=rfid_cardinfo.rfid;
这个SQL语句能执行通。下面是在VC下面的不通报个错误,弄的我莫名其妙
第一个错误是:
newline in const(是只读的意思,具体怎么写和这个差不多)
编译环境是VC 6.0
CString sz_startyear;
CString sz_starthour;
CString sz_oveyear;
CString sz_overhour;
sz_startyear="0011-3-10";
sz_starthour="17:20:00";
sz_overyear="0011-6-10";
sz_overhour="17:20:00";
CString str1=sz_startyear+" "+sz_starthour;
CString str2=sz_overyear+" "+sz_overhour;
myquery->CommandText=_bstr_t("select car_id,pass_log.RFID,pass_time,pass_type from pass_log,rfid_cardinfo
where pass_time
between
to_date('"+str1+"','YYYY-MM-DD HH24:MI:SS') and
to_date('"+str2+"','YYYY-MM-DD HH24:MI:SS') and
pass_log.rfid=rfid_cardinfo.rfid ");
select car_id,pass_log.RFID,pass_time,pass_type from pass_log,rfid_cardinfo
where pass_time
between
to_date('0011-3-10 17:20:00','YYYY-MM-DD HH24:MI:SS') and
to_date('0011-6-10 17:20:00','YYYY-MM-DD HH24:MI:SS') and pass_log.rfid=rfid_cardinfo.rfid;
这个SQL语句能执行通。下面是在VC下面的不通报个错误,弄的我莫名其妙
第一个错误是:
newline in const(是只读的意思,具体怎么写和这个差不多)
编译环境是VC 6.0
CString sz_startyear;
CString sz_starthour;
CString sz_oveyear;
CString sz_overhour;
sz_startyear="0011-3-10";
sz_starthour="17:20:00";
sz_overyear="0011-6-10";
sz_overhour="17:20:00";
CString str1=sz_startyear+" "+sz_starthour;
CString str2=sz_overyear+" "+sz_overhour;
myquery->CommandText=_bstr_t("select car_id,pass_log.RFID,pass_time,pass_type from pass_log,rfid_cardinfo
where pass_time
between
to_date('"+str1+"','YYYY-MM-DD HH24:MI:SS') and
to_date('"+str2+"','YYYY-MM-DD HH24:MI:SS') and
pass_log.rfid=rfid_cardinfo.rfid ");
例如下面的写法是错误的:
CString str = "This is a
long line";
要改为:
CString str = "This is a"
"long line";
" long line";