while not data_m.ADO_km.Eof do
begin
for i := 0 to listbox2.Items.Count - 1 do
begin
if data_m.ADO_km.FieldValues['kmmc'] <> listbox2.Items[i] then
begin
listbox1.Items.Add(data_m.ADO_km.FieldValues['kmmc']);
data_m.ADO_km.Next;
end;
end;
end;
上面的程序运行后单击button按钮正常显示
而下面的代码欲行后就程序就死了
为什么呢?没感觉不一样啊
while not data_m.ADO_km.Eof do
begin
flag := false;
for i := 0 to listbox2.Items.Count - 1 do
begin
if data_m.ADO_km.FieldValues['kmmc'] = listbox2.Items[i] then
begin
flag := true;
break;
end;
end;
if not flag then
begin
listbox1.Items.Add(data_m.ADO_km.FieldValues['kmmc']);
data_m.ADO_km.Next;
end;
end; }