procedure TForm10.FormCreate(Sender: TObject); begin with dm.ADOQuery1 do begin open; first; while not eof do begin combobox1.Items.Add(fields[6].Value ); next; end; combobox1.ItemIndex :=0; end; end; end. 这段程序是从数据库里调用某个字段的数据,假如数据库的某个字段值是1、2、 3、2,在combox里列出来的数据也将是1、2、3、2,而我想把那个重复的2给合并了就显示1、2、3,大哥们帮我
----------------------------------------------
我是菜鸟!
procedure TForm10.FormCreate(Sender: TObject); begin with dm.ADOQuery1 do begin close; sql.Clear; sql.Text:='select distinct * from edit'; open; first; while not eof do begin combobox1.Items.Add(fields[4].Value ); next; end; combobox1.ItemIndex :=0; end; end; 还是不行啊!一样的
----------------------------------------------
我是菜鸟!
那样我也试过的, : procedure TForm10.FormCreate(Sender: TObject); begin with dm.ADOQuery1 do begin close; sql.Clear; sql.Text:='select distinct ht_danwei from edit'; open; first; while not eof do begin combobox1.Items.Add(fields[4].Value ); next; end; combobox1.ItemIndex :=0; end; 不行的,fields[4]就找不到了
----------------------------------------------
我是菜鸟!