窗体上有16个Combobox和16个Edit,分别一一对应,每个Combobox的Items都是一样的(设计阶段就已设置了所有的Items),Combobox用来显示科目名,对应的Edti用来显示成绩,那么怎样让用ADOQuery选出来的记录对应到各个Combobox和Edit,选出的记录一定是小于或等于16个,比如选出的记录如下:数学 82.0
历史 95.0
音乐 100.0
物理 85.0
语文 82.0
化学 92.0那么就要把科目名依次放到各个Combobox中显示,“数学”放在Combobox1,并且对应的Edit显示数学分数82.0,“历史”放在Combobox2,等等一次类推。
历史 95.0
音乐 100.0
物理 85.0
语文 82.0
化学 92.0那么就要把科目名依次放到各个Combobox中显示,“数学”放在Combobox1,并且对应的Edit显示数学分数82.0,“历史”放在Combobox2,等等一次类推。
解决方案 »
- 请教:怎样对图像进行边界链码操作,然后数出边界内象素点的个数
- 大家好,谢谢支持
- 怎么判断一个 TMenuItem 是属于 TMainMenu 还是 TPopupMenu ?
- 急求《Delphi串口通信技术与工程实践》的电子版,在线等!!!
- 高分求Sui那公司的控件?
- 高分求解:TreeView控件的难题
- 如何取得浏览器内用鼠标选中的文本,用webbrowser控件
- 那位大哥说说加油机是怎样实现加油量的控制的...
- 请问在Oracle中如何定义Bool类型的字段?
- 请教,ADO sp1在那下载!!!!!!知道的请进。急!!!!!!!!!
- 我用虚拟驱动器的方法在一台电脑上使用另一台电脑上的ACCESS数据库,但在使用中如果网络断了,数据库也破坏了不能用了,怎办?
- 读取注册表键值的问题?(binary和DWord类型的)
i := 1;
while not ADOQuery1.Eof do
begin
TCombobox(FindComponent('Combobox' + inttostr(i))).text := ADOQuery1.FieldByName('科目名').asstring;
TEdit(FindComponent('Edit' + inttostr(i))).text := ADOQuery1.FieldByName('分数名').asstring;
ADOQuery1.next;
i := i + 1;
end;
之后,就用楼上的方法
adoquery1.sql.clear;
adoquery1.sql.add('select * from tablename');
adoquery1.open;
if combobox1.text='数学' then edit1.text:=adoquery1.parambyname('数学').value;
;;;;
;;;;;
;;;;;
类推
不知道能帮你吗?
如果各科成绩在一条记录的话 直接select * from yourtable 就行了
如果各科成绩不在一条记录的话 sql语句要复杂一点点
ADOQuery1.first;
i := 1;
while not ADOQuery1.Eof do
begin
TCombobox(FindComponent('Combobox' + inttostr(i))).text := ADOQuery1.FieldByName('科目名').asstring;
TEdit(FindComponent('Edit' + inttostr(i))).text := ADOQuery1.FieldByName('分数名').asstring;
ADOQuery1.next;
TCombobox(FindComponent('Combobox' + inttostr(i))).visible := true ;
TEdit(FindComponent('Edit' + inttostr(i))).visible := true ;
i := i + 1;
end;