最好是在添加数据库时就判断是否有重复,但在这儿也可以:
table1.first;
combobox1.items.clear;
while not table1.eof do
begin
fieldstring:=table1.fieldbyname('fieldname').asstring;
for i:=0 to combobox1.Items.Count do
begin
if combobox1.Items.Strings=fieldstring then
begin
showmessage('have');
Break;
end;
end;
if i>combobox1.Items.Count then
combobox1.items.add(fieldstring);
table1.next;
end;