我想做合并查询,代码如下:
choice:=combobox1.text;
content:=edit1.Text;
choice1:=combobox4.Text;
content1:=edit2.Text;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQl.add('select * from xuesheng_table where ('+choice+'
like ''%'+content+'%'')and');
adoquery1.sql.Add('('+choice1+' like ''%'+content1+'%'')');
adoquery1.Open;请教下执行的SQL语句错在哪里 (like附近有语法错误)
choice:=combobox1.text;
content:=edit1.Text;
choice1:=combobox4.Text;
content1:=edit2.Text;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQl.add('select * from xuesheng_table where ('+choice+'
like ''%'+content+'%'')and');
adoquery1.sql.Add('('+choice1+' like ''%'+content1+'%'')');
adoquery1.Open;请教下执行的SQL语句错在哪里 (like附近有语法错误)
解决方案 »
- 如何让软件变得不那么山寨。。
- 怎么控制 trzsiepanel 的开闭
- 请大家帮帮我。
- qryWork与qryshow引用的是什么单元
- 后台合并文档!
- 将dos内部命令结果输出到Console Window
- 表中两个字段编号和姓名,其中编号为主键和标识(SQL Server) ,请问AppendRecord([...])如何写?编号这个字段因为设为标识所以是自己递增
- 谁能帮我翻译一个delphi工程,人民币购买
- 急问,请问如下配置硬件大概值多少钱?急
- 如果使一个与数据库中的日期字段相连的DBtext或DBedit 里只显示日期,不显示时间???
- 容易得分的问题,在线等!!!!!
- dbgrid的问题啊
adoquery1.SQl.add('select * from xuesheng_table where ('+choice+
' like ''%'+content+'%'') and ');
adoquery1.sql.Add('('+choice1+' like ''%'+content1+'%'')');
adoquery1.SQl.add('select * from xuesheng_table where ('+choice+
' like ''%'+content+'%'') and ');
adoquery1.sql.Add('('+choice1+' like ''%'+content1+'%'')');
adoquery1.SQL.Clear;
adoquery1.SQl.add('select * from xuesheng_table where ('+choice+'
like ''%'+content+'%'')and');
adoquery1.sql.Add('('+choice1+' like ''%'+content1+'%'')');
edit1.text:=sql.text;
//adoquery1.Open;
加个EDIT把SQL显示出来, 一看不就明白了.
adoquery1.SQL.Clear;
adoquery1.SQl.add(Format('select * from xuesheng_table where ( %s
like '%%s%') and %s like '%%s%')' , choice, content, choice1,content1);
like ''%'+content+'%'')and');
-------------〉 adoquery1.SQl.add('select * from xuesheng_table where ('+choice+'
like ''%'+content+'%'') and');