代码如下 . while not tempq.Eof do begin combobox1.Items.Add(tempq.fieldbyname('class_name_1').asstring); tempq.Next ; end;begin
end ;
tempq.first; while not tempq.Eof do begin combobox1.Items.Add(tempq.fieldbyname('class_name_1').asstring); tempq.Next ; end;
我试着用了dblookupcombobox,不过查询出来的值有很多重复阿 怎么去掉重复的值呢?
我试着用了dblookupcombobox,不过查询出来的值有很多重复阿 怎么去掉重复的值呢?
查询语句中用Select distinct(字段名)from 表
Readado.close; Readado.SQL.clear; ReadAdo.SQL.add('select distinct(字段名) from 表名'); ReadAdo.Open; ReadAdo.First; while not ReadAdo.Eof do begin ComboBox1.Items.Add(ReadAdo.fieldbyname('字段名').asstring); ReadAdo.Next; end;
while not tempq.Eof do
begin
combobox1.Items.Add(tempq.fieldbyname('class_name_1').asstring);
tempq.Next ;
end;begin
end ;
tempq.first;
while not tempq.Eof do
begin
combobox1.Items.Add(tempq.fieldbyname('class_name_1').asstring);
tempq.Next ;
end;
怎么去掉重复的值呢?
怎么去掉重复的值呢?
Readado.SQL.clear;
ReadAdo.SQL.add('select distinct(字段名) from 表名');
ReadAdo.Open;
ReadAdo.First;
while not ReadAdo.Eof do
begin
ComboBox1.Items.Add(ReadAdo.fieldbyname('字段名').asstring);
ReadAdo.Next;
end;
来列出,就可以了
不过有个问题。DBLookupComboBox怎么清空呢?我发现人家选过一次之后
这个combobox就总是保留了最后一次的选择,不能清空。