建一query1 ,其sql: select 专业名 from 系表 where 系名=:xm 在系名combobox(combobox_xm)的OnChange事件里写 with query1 do begin close; parambyname('xm').asstring:=combobox_xm.items[combobox_xm.itemindex];//xm:系名 open; combobox_zy.items.clear;//zy:专业 first; while not eof do begin combobox_zy.items.add(fieldbyname('zym').asstring);//zym:专业名字段 end;//end with
在系名combobox(combobox_xm)的OnChange事件里写
with query1 do begin
close;
parambyname('xm').asstring:=combobox_xm.items[combobox_xm.itemindex];//xm:系名
open;
combobox_zy.items.clear;//zy:专业
first;
while not eof do begin
combobox_zy.items.add(fieldbyname('zym').asstring);//zym:专业名字段
end;//end with