ADOQuery1.sql.add('select * from ku where');
adoquery1.SQL.Add('xh='''+combobox1.Text+'''');
adoquery1.SQL.Add('and rq BETWEEN '''+datetostr(begin_date.Date)+''' and '''+datetostr(end_date.date)+'''');
提示“=”附近有错误
adoquery1.SQL.Add('xh='''+combobox1.Text+'''');
adoquery1.SQL.Add('and rq BETWEEN '''+datetostr(begin_date.Date)+''' and '''+datetostr(end_date.date)+'''');
提示“=”附近有错误
解决方案 »
- C#转Delphi,大家觉得如何?
- 回首…
- 将dbgrid中的数据导入到excel中后,数据不能进行累加,显示是文本类型,不是数字类型。
- 小问题~~~~帮帮忙~~~~关于ADO的
- (100分)求文件管理系统 源码
- fastreport实现WEB应用中报表,共同探讨
- speedbutton的numglyph设置为4,但图片仍然只能有两种状态是什么原因呢?
- 不爽啊!散份
- treeview小问题,加到80分了!!!
- 在线提问:我在用ADO连接数据库时为什么在执行时老是报“Invalid variant type conversion”错误提示???
- 我想买一份简单的进销存源代码学着玩
- 郁闷,散一点分
ADOQuery1.sql.add(' select * from ku where');
adoquery1.SQL.Add(' xh='''+combobox1.Text+'''');
adoquery1.SQL.Add(' and rq BETWEEN '''+datetostr(begin_date.Date)+''' and '''+datetostr(end_date.date)+'''');
ADOQuery1.sql.clear; if trim(combobox1.Text)='任意' then
ADOQuery1.sql.add('select * from ku where rq BETWEEN '''+datetostr(begin_date.Date)+''' and '''+datetostr(end_date.date)+''''); if trim(combobox1.text)<>'任意' then
ADOQuery1.sql.add('select * from ku where');
adoquery1.SQL.Add(' xh='''+combobox1.Text+'''');
adoquery1.SQL.Add('and rq BETWEEN '''+datetostr(begin_date.Date)+''' and '''+datetostr(end_date.date)+'''');刚才试过了,我要是在combobox1中不选任意,就没事,只要一选任意,就提示我在xh附近有错! ADOQuery1.open;
begin
CLose;
SQL.Add('select * from ku where ');//注意空格
SQL.Add('xh='''+combobox1.Text+''' '); //注意空格
SQL.Add('and rq BETWEEN '''+datetostr(begin_date.Date)+''' and '''+datetostr(end_date.date)+'''');end;
adoquery1.sql.add('select * from ku where');
adoquery1.sql.add(' xh = '+''''+combobox1.text+'''');
adoquery1.sql.add(' and rq BETWEEN '+''''+datetostr(begin_date.date)+''''+'and'
+''''+datetostr(end_date.date)+'''');
ADOQuery1.sql.clear; if trim(combobox1.Text)='任意' then
ADOQuery1.sql.add(' select * from ku where rq BETWEEN '''+datetostr(begin_date.Date)+''' and '''+datetostr(end_date.date)+''''); if trim(combobox1.text)<>'任意' then
ADOQuery1.sql.add(' select * from ku where');
adoquery1.SQL.Add(' xh='''+trim(combobox1.Text)+'''');
adoquery1.SQL.Add(' and rq BETWEEN '''+datetostr(begin_date.Date)+''' and '''+datetostr(end_date.date)+''''); ADOQuery1.open;先谢谢楼上几位,改成这样还是不行,“xh”附近有错误
ADOQuery1.sql.clear;
ADOQuery1.sql.add(' select * from ku where 1=1 ');
if trim(combobox1.text)<>'任意' then
begin
adoquery1.SQL.Add(' and xh='''+trim(combobox1.Text)+'''');
adoquery1.SQL.Add(' and rq BETWEEN '''+datetostr(begin_date.Date)+''' and '''+datetostr(end_date.date)+'''');
end ADOQuery1.open;加個1=1 ,不管有沒有條件都是加 'and '
ADOQuery1.sql.clear; if trim(combobox1.Text)='任意' then
ADOQuery1.sql.add(' select * from ku where rq BETWEEN '''+datetostr(begin_date.Date)+''' and '''+datetostr(end_date.date)+'''') else
begin
ADOQuery1.sql.add(' select * from ku where');
adoquery1.SQL.Add(' xh='''+trim(combobox1.Text)+'''');
adoquery1.SQL.Add(' and rq BETWEEN '''+datetostr(begin_date.Date)+''' and '''+datetostr(end_date.date)+'''');
end;
ADOQuery1.open;