大大们,帮我看看我的时间查询到底那里出错
代码
ttd=DateTimePicker1-> Date.CurrentDate();
ttd=ttd+ " ";
ttd1=ttd+i+ ":0:0 ";
ttd2=ttd+(i+1)+ ":0:0 ";
SQLC = "select max(Val) as MaxVal from Table where ";
SQLC =SQLC+ " DateAndTime between ' "+DateTimePicker1-> Date.DateString()+ " ' and ' "+DateTimePicker1-> Date.DateString()+ " ' ";
// SQLC = "select max(Val) as MaxVal from Table where ";
// SQLC =SQLC+ " DateAndTime between ' ";
// SQLC = SQLC+ttd1+ " ' and ' "+ttd2+ " ' " ;
Query2-> SQL-> Clear();
Query2-> SQL-> Add(SQLC);
Query2-> Open();
我用上面两种方法写sql语句,结果一运行就报错:
Project tt.exe raised exception class EDBEngineError with message 'General SQL error.
[Microsoft][ODBC Microsoft access Driver]标准表达式中数据类型不匹配。’
请大家帮我看看到底错在什么地方啊 我用的SQL2000数据库
[解决办法]
Query2-> SQL-> Clear();
Query2-> SQL-> Add(SQLC);
Query2-> ParamCheck=false; // 加这句试试
Query2-> Open();