DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: jeff1314
今日帖子: 10
在线用户: 13
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
女 yechenwen (wenwen) ★☆☆☆☆ -
普通会员
2003/9/20 17:10:45
标题:
救救我吧!!! 浏览:1989
加入我的收藏
楼主: wfcform.adoquery1.sql.add('select * from wwfa');
if edit1.text<>' then
   begin
   wfcform.adoquery1.sql.add('where wnf=''+edit1.text+'');
   end;
if combobox1.text<>'所有' then
   begin
   wfcform.adoquery1.sql.add('and wjj=''+combobox1.text+'');
   end;
if combobox2.text<>'所有' then
   begin
   wfcform.adoquery1.sql.add('and wjl1=''+combobox2.text+'');
   end;
if combobox3.text<>'所有' then
   begin
   wfcform.adoquery1.sql.add('and wjl2=''+combobox3.text+'');
   end;
if edit2.text<>' then
   begin
   wfcform.adoquery1.sql.add('and wjb like '%'+edit2.text+'%'');
   end;
if edit3.text<>' then
   begin
   wfcform.adoquery1.sql.add('and wjz like '%'+edit3.text+'%'');
   end;

好像语句有错,可我不知道怎么改,帮忙看看吧
----------------------------------------------
-
作者:
男 happychui (开心人) ★☆☆☆☆ -
盒子活跃会员
2003/9/20 18:24:00
1楼: 如果Edit1.Text = '是就会出错, 

select * from wwfa and wjj=''+combobox1.text+''
                ~~~~~~~~~
          少了Where 和 多了And
----------------------------------------------
-
作者:
男 yiqiu (忆秋) ★☆☆☆☆ -
普通会员
2003/9/21 9:52:26
2楼: 可以这样
wfcform.adoquery1.sql.add('select * from wwfa where 1=1 ');
这样一来下面就不必判断是否有WEHRE了。省很大的劲了:)

----------------------------------------------
-
作者:
女 yechenwen (wenwen) ★☆☆☆☆ -
普通会员
2003/9/21 15:39:36
3楼: 我知道了,谢谢。
----------------------------------------------
-
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行54.6875毫秒 RSS