if ComboBox.text='报刊名称' then ADOQUERY.SQL.add('select * FROM 表名 where 报刊名称='+'''' + edit.text + '''') elseif ComboBox.text='邮发代号' then ADOQUERY.SQL.add('select * FROM 表名 where 邮发代号' ='+'''' + edit.text + '''')
人家都说了是模糊查询了--------------------------follow me! if Trim(StationName.Text)<>'' then lSql:=lSql+' and StationName like "%'+Trim(StationName.Text)+'%"';你自己改改就可以了GOD BLESS YOU!
用了ADOQUERY或者adodatabase索引和需要的字段就可以了 select field1,field3,field.. from table where ....
to qxj(小小小小小小程序员)怎么用参数???
adoquery中用like ; adoquery1.close; adoquery1.clear; adoquery1.sql.add('select * from tablename wehre 报刊名称 like :edit'); adoquery1.parameters.parabyname('edit').values:='%' + trim(combox1.text) + '%'; adoquery1.open;
ADOQUERY.SQL.add('select * FROM 表名 where 报刊名称='+'''' + edit.text + '''')
elseif ComboBox.text='邮发代号' then
ADOQUERY.SQL.add('select * FROM 表名 where 邮发代号' ='+'''' + edit.text + '''')
adoquery1.parameters[0].values:=combobox1.text;
adoquery1.parameters[1].values:=edit1.text;
adoquery1.open;
没有测试,不知可不可以!
ADOQUERY.SQL.add('select * FROM 表名 where 报刊名称='+'''' + edit.text + '''')
报刊名称处也可动态的取啊
字段名是英文显示为中文
adoquery1.sql.add('select * from tablename wehre :combobox = :edit');
adoquery1.parameters[0].values:=; //combobox1.text这里从字典表中取字段名
adoquery1.parameters[1].values:=edit1.text;
adoquery1.open;
if Trim(StationName.Text)<>'' then
lSql:=lSql+' and StationName like "%'+Trim(StationName.Text)+'%"';你自己改改就可以了GOD BLESS YOU!
select field1,field3,field.. from table where ....
adoquery1.close;
adoquery1.clear;
adoquery1.sql.add('select * from tablename wehre 报刊名称 like :edit');
adoquery1.parameters.parabyname('edit').values:='%' + trim(combox1.text) + '%';
adoquery1.open;