SQL语句为 SELECT FIELDNAME FROM TABLE
我想把FIELDNAME字段中所有的值都显示在COMBOBOX的下拉列表中,我是初学者,请大家说的详细点好吗?
我想把FIELDNAME字段中所有的值都显示在COMBOBOX的下拉列表中,我是初学者,请大家说的详细点好吗?
解决方案 »
- Delphi 2011-3专家榜 top20
- 请问,delphi如何打印特殊票据呀?
- 苦腦中!連續問了三四個問題,在這裏居然都沒有找到答案!散分...
- 在DOS下使用DCC32编译出现的问题
- 散分拉 ,感谢大家,混个脸熟!/???那就在放一次!!!/顶者有分!
- 开发多语言系统,用哪个版本的windows较好?对不起没分了!
- 请教隐藏硬盘及限制IE访问硬盘的问题
- 请指教有关bde和9i的问题
- 怎样给TcheckListBox添加关闭事件,当监听到关闭的时候执行一段代码
- delphi操作word的问题
- 请问我的FastReport报表为什么每打一页总要多走差不多半页纸?我得纸张大小正确!
- 请问:如何在DLL文件中保存一个内存地址,让主程序写入地址后,子程序再读取?
procedure Tfrm_main.RadioBtnClick(Sender: TObject);
begin
try
with DM.ADODataSet do
begin
close; //FIELDNAME
commandtext:='select '+ trim(RadioBtn.Caption)+' FROM TABLE';
open ;
ComboBox.Items.Clear;
end;//with
while not (DM.ADODataSet.Eof) do
begin
ComboBox.Items.Add(DM.ADODataSet.Fields[0].AsString);
DM.ADODataSet.Next;
end;//while
finally
DM.ADODataSet.Close;
end;//try
end;
query.open;
query.first;
while not query.isempty do
begin
combobox.items.add(query.fields[0].value)
query.next
end;
或者用循环赋值也是可以的,原理都是一样的,或者用dbcombobox吧
procedure TRoom_Code.FormCreate(Sender: TObject);
begin
try
with DataModule1.ADOR_State do
begin
close; //FIELDNAME
commandtext:='select RS_State from R_State';
open ;
CR_State.Items.Clear;
end;//with
while not (DataModule1.ADOR_State.Eof) do
begin
CR_State.Items.Add(DataModule1.ADOR_State.Fields[0].AsString);
DataModule1.ADOR_State.Next;
end;//while
finally
DataModule1.ADOR_State.Close;
end;//trytry
with DataModule1.ADOR_Type do
begin
close; //FIELDNAME
commandtext:='select * from R_Standard';
open ;
CR_Standard.Items.Clear;
end;//with
while not (DataModule1.ADOR_Type.Eof) do
begin
CR_Standard.Items.Add(DataModule1.ADOR_Type.Fields[1].AsString);
DataModule1.ADOR_Type.Next;
end;//while
finally
DataModule1.ADOR_Type.Close;
end;//try
end;
记录已到了最后一条了,那样显示不出问
题吗?
我想应该在while not (DataModule1.ADOR_Type.Eof) do
之前应该把记录指针定位到第条1条记录吧
不知道我说的是不是哦。
希望细心点