正在装载数据…… 第一个表 procedure Tfrm_BroadcastCenter.FormCreate(Sender: TObject); var errmsg,sql: string; i: integer; begin inherited; //创建数据链表 FpDataList := TList.Create; stringList1:=TStringList.Create; stringList2:=TStringList.Create; stringList3:=TStringList.Create; stringList1.Clear; //cxComboBox4.Clear; //显示查询项中省的内容 sql:='select * from PROVINCE'; if ExecADOQueryMsg('MainCon', sql, adoquery, errmsg) then begin i := 1; while not ADOQuery.Eof do begin cxComboBox4.Properties.Items.Add(ADOQuery.fieldbyname('NAME').AsString); stringList1.Add(ADOQuery.fieldbyname('PROVINCEID').AsString); //cxComboBox4.Properties.Items.in ADOQuery.Next; end; end end; 第二个表 procedure Tfrm_BroadcastCenter.cxComboBox4PropertiesChange( Sender: TObject); var errmsg,sql: string; i: integer; begin inherited; stringList2.Clear; cxComboBox5.Properties.Items.Clear; cxComboBox5.Text:=''; cxComboBox6.Text:=''; //显示查询项中市的内容 sql:='select * from CITY where FATHER=''' + StringList1.Strings[cxComboBox4.ItemIndex] + ''''; if ExecADOQueryMsg('MainCon', sql, adoquery, errmsg) then begin i := 1; while not ADOQuery.Eof do begin cxComboBox5.Properties.Items.Add(ADOQuery.fieldbyname('NAME').AsString); stringList2.Add(ADOQuery.fieldbyname('CITYID').AsString); ADOQuery.Next; end; end end; 第三个表 procedure Tfrm_BroadcastCenter.cxComboBox5PropertiesChange( Sender: TObject); var errmsg,sql: string; i: integer; begin inherited; stringList3.Clear; cxComboBox6.Properties.Items.Clear; cxComboBox6.Text:=''; //显示查询项中县的内容 sql:='select * from AREA where FATHER=''' + StringList2.Strings[cxComboBox5.ItemIndex] + ''''; if ExecADOQueryMsg('MainCon', sql, adoquery, errmsg) then begin i := 1; while not ADOQuery.Eof do begin cxComboBox6.Properties.Items.Add(ADOQuery.fieldbyname('NAME').AsString); stringList3.Add(ADOQuery.fieldbyname('AREAID').AsString); ADOQuery.Next; end; end end; end.
本文来源:http://blog.csdn.net/linjie_here/archive/2007/08/21/1752910.aspx
|