begin
CDBMODULE.SearchData.First;
while not CDBMODULE.SearchData.Eof do
begin
editForm.ComboBox1.Items.Add(CDBMODULE.SearchData.fieldbyname( 'GJ ').asstring);
editForm.ComboBox2.Items.Add(CDBMODULE.SearchData.fieldbyname( 'LB ').asstring);
CDBMODULE.SearchData.Next;
end;
end; 怎样在这段中去除重复和空值的记录,两个字的GJ和LB. 急!!!!!! 谢谢了!
CDBMODULE.SearchData.First;
while not CDBMODULE.SearchData.Eof do
begin
editForm.ComboBox1.Items.Add(CDBMODULE.SearchData.fieldbyname( 'GJ ').asstring);
editForm.ComboBox2.Items.Add(CDBMODULE.SearchData.fieldbyname( 'LB ').asstring);
CDBMODULE.SearchData.Next;
end;
end; 怎样在这段中去除重复和空值的记录,两个字的GJ和LB. 急!!!!!! 谢谢了!
function exist(s:string;ss:TStringS):boolean;
var
len,i:integer;
begin
result:=false;
len:=ss.Count;
for i:=0 to len-1 do
if ss[i]=s then
begin
result:=true;
break;
end;
end;
然后,再你的程序中调用
begin
CDBMODULE.SearchData.First;
while not CDBMODULE.SearchData.Eof do
begin
GJstr:=CDBMODULE.SearchData.fieldbyname( 'GJ ').asstring;
LBstr:=CDBMODULE.SearchData.fieldbyname( 'LB ').asstring;
if (gjstr<>'') and (LBstr<>'') then
if not (exist(GJstr,combobox1.item) and exist(LBstr,combobox2.item)) then
begin
editForm.ComboBox1.Items.Add(GJstr);
editForm.ComboBox2.Items.Add();
CDBMODULE.SearchData.Next;
end;
end;
end;