我做了个查询窗体,
查询的条件比较多:州地市,单位,税务机关,税管员,税种,行业,行业明细
这些条件都是用下拉组合框(combobox)来显示的。
比如:
我在州地市里选“四川省成都市”,后面的单位组合框就只能显示“成都市的单位”
我该怎么操作了?
谢谢!
高手们,帮忙啊!
谢谢!!!!!!!!
查询的条件比较多:州地市,单位,税务机关,税管员,税种,行业,行业明细
这些条件都是用下拉组合框(combobox)来显示的。
比如:
我在州地市里选“四川省成都市”,后面的单位组合框就只能显示“成都市的单位”
我该怎么操作了?
谢谢!
高手们,帮忙啊!
谢谢!!!!!!!!
解决方案 »
- 定义公式自动计算
- 如何使用随机函数?
- 如何遞歸動態加載MainMenu菜單
- 哪位把VC里面Dx90SDK\sample\c++\VMR9\vmrplayer 转换为Delphi?
- 还是quickreport的问题::subdetail
- 关于delphi中的Socket组件编程问题,如何处理10054(连接重置)异常?
- 大华播放sdk转换delphi很多值获取不正确,请高人帮看看
- 大家认为铁道出版社的《Delphi5.0彻底研究》怎样?
- delphi5编译时提示找不到system.pas,如何解决
- 谁用过SYBASE SQL ANYWHERE,能否两个WIN98连同一个数据库
- MessageDialog 这个组件的哪个属性是控制显示图片的不同
- 自定义控件中移动父窗体
把combobox的文本值設置成相應的查詢條件.
但是没有实现我在form2.onshow事件中写了
combobox提取数据库数据并显示的代码。这样对combobox的onchange的事件有影响吗?
应该用combobox(加载主表的内容)和dbgrid(用于显示子表的内容),
在combobox的onchange中来写sql语句动态查询子表内容,这样应该简单一些.
所以我就在form2.onshow事件中写了combobox提取数据库数据并显示的代码
现在的问题是我在combobox的onchange中写了代码,不改变(选择了"州地市",而单位combobox中显示的仍然是全部的单位,没有将所选择的"州地市"的单位).
不知道是不是form2.onshow已经确定了combobox显示的内容,不能在改变了吗?谢谢!!
s1:=copy(combobox1.Text,1,pos('[',combobox1.text)-1);//提取combobox1中的数字
select city_num,city_name from dsbm.bmcity where city_num like '+s1+'
谢谢!!
我在combobox1的onchange事件中写的 是改变combobox2内容的代码
但是就是实现不了,显示的还是全部的内容.
不知道是什么原因.谢谢!!
s1:=copy(combobox1.Text,1,pos('[',combobox1.text)-1);//提取combobox1中的数字
select city_num,city_name from dsbm.bmcity where city_num like '+s1+'
谢谢!! ________________________________________________-s1:=Trim(combobox1.text);
Select City_num,City_name From Dsbm.bmcity Where City_num like +QuotedStr('%'+s1+'%');
只是去掉里面的空格,我combobox1.text中有数字和汉字(如:001[扩大解放后]),
现在我只是提取001即可.麻烦在帮我看下,
我的意思是:如果"州地市"combobox中没有选择(为空),那么"单位"combobox中就应该显示的是数据库中的"全部单位"
所以我就在form2.onshow事件中写了combobox提取数据库数据并显示的代码
现在的问题是我在combobox的onchange中写了代码,不改变(选择了"州地市",而单位combobox中显示的仍然是全部的单位,没有将所选择的"州地市"的单位).
不知道是不是form2.onshow已经确定了combobox显示的内容,不能在改变了吗? 谢谢!!
form.show事件代码:
procedure TForm2.FormShow(Sender: TObject);
var s1,s2,s3,s4,s5,s6,s7:string;
begin
s1:=copy(combobox1.Text,1,pos('[',combobox1.Text)-1);//州地市
s2:=copy(combobox2.Text,1,pos('[',combobox2.Text)-1);//单位
s3:=copy(combobox3.Text,1,pos('[',combobox3.Text)-1);//税务机关
s4:=copy(combobox4.Text,1,pos('[',combobox4.Text)-1);//税管员
s5:=copy(combobox5.Text,1,pos('[',combobox5.Text)-1); //行业
s6:=copy(combobox6.Text,1,pos('[',combobox6.Text)-1); //注册类型
s7:=copy(combobox7.Text,1,pos('[',combobox7.Text)-1); //行业明细
//州地市LJClientDataSet2.Close;
LJClientDataSet2.Provider.DataRequest('select zds_code ,zds_name from dsbm.bmzds order by zds_code /');
LJClientDataSet2.Open;
while not LJClientDataSet2.Eof do
begin
combobox1.Items.Add(LJClientDataSet2.fieldbyname('zds_code').asstring+'['+LJClientDataSet2.fieldByName('zds_name').asstring+']');
LJClientDataSet2.Next;
end;
//单位
LJClientDataSet5.Close;
LJClientDataSet5.Provider.DataRequest(
'select city_num,short_name from dsbm.bmcity '+
' /');
LJClientDataSet5.Open;
while not LJClientDataSet5.Eof do
begin
combobox2.Items.Add(LJClientDataSet5.fieldByName('city_num').asstring+'['+LJClientDataSet5.fieldbyname('short_name').asstring+']');
LJClientDataSet5.Next;
end;//税务机关LJClientDataSet3.Close;
LJClientDataSet3.Provider.DataRequest('select jg_code,jg_name from dsbm.swjg '+
' order by jg_code /');
LJClientDataSet3.Open;
while not LJClientDataSet3.Eof do
begin
combobox3.Items.Add(LJClientDataSet3.fieldbyname('jg_code').asstring+'['+LJClientDataSet3.fieldbyname('jg_name').asstring+']');
//combobox3.Items.Add(LJClientDataSet3.fieldbyname('jg_name').asstring);
LJClientDataSet3.Next;
end;
//税管员 LJClientDataSet8.Close;
LJClientDataSet8.Provider.DataRequest('select oper_num,oper_name from dsbm.oper_def where cxjc=5 order by oper_num /');
LJClientDataSet8.Open;
while not LJClientDataSet8.Eof do
begin
combobox4.Items.Add(LJClientDataSet8.fieldbyname('oper_num').asstring+'['+LJClientDataSet8.fieldbyname('oper_name').asstring+']');
LJClientDataSet8.Next;
end;// 行业
LJClientDataSet4.Close;
LJClientDataSet4.Provider.DataRequest('select hy_old,hy_name from dsbm.bmhy /');
LJClientDataSet4.Open;
while not LJClientDataSet4.Eof do
begin
combobox5.Items.Add(LJClientDataSet4.fieldbyname('hy_old').asstring+'['+LJClientDataSet4.fieldbyname('hy_name').asstring+']');
LJClientDataSet4.Next;
end;
//注册类型
LJClientDataSet7.Close;
LJClientDataSet7.Provider.DataRequest('select jj,jj_name from dsbm.bmjj /');
LJClientDataSet7.Open;
while not LJClientDataSet7.Eof do
begin
combobox6.Items.Add(LJClientDataSet7.fieldbyname('jj').asstring+'['+LJClientDataSet7.fieldbyName('jj_name').asstring+']');
LJClientDataSet7.Next;
end; //行业明细
LJClientDataSet6.Close;
LJClientDataSet6.Provider.DataRequest('select bm,bmnr from dsbm.bmhyxm order by bm /');
LJClientDataSet6.Open;
while not LJClientDataSet6.Eof do
begin
combobox7.Items.Add(LJClientDataSet6.fieldbyname('bm').asstring+'['+LJClientDataSet6.fieldbyname('bmnr').asstring+']');
LJClientDataSet6.Next;
end; end;combobox.change事件代码:procedure TForm2.ComboBox3Change(Sender: TObject); //更改税管员
var s3:string;
begin
s3:=copy(combobox3.Text,1,pos('[',combobox3.Text)-1);
LJClientDataSet8.Close;
LJClientDataSet8.Provider.DataRequest('select oper_num,oper_name from dsbm.oper_def '+
'where bumen_code in (select jg_code from dsbm.swjg where jg_code='+s3+')and cxjc=5 order by oper_num / ');
LJClientDataSet8.Open;
while not LJClientDataSet8.Eof do
begin
combobox4.Items.Add(LJClientDataSet8.fieldbyname('oper_num').asstring+'['+LJClientDataSet8.fieldbyname('oper_name').asstring+']');
LJClientDataSet8.Next;
end;
end;现在的问题是combobox中的内容没有改变高手们帮帮忙啊!!!!!!!
ComBoBox4.Items.Clear;
然后再加内容;while not LJClientDataSet8.Eof do
begin
combobox4.Items.Add(LJClientDataSet8.fieldbyname('oper_num').asstring+'['+LJClientDataSet8.fieldbyname('oper_name').asstring+']');
LJClientDataSet8.Next;
end;