——此文章摘自《Delphi开发经验技巧宝典》定价
¥
特价
¥
购买>>http://track
linktech
cn/?m_id=dangdang&a_id=A
&l=
&l_type
=
width=
height=
border=
nosave>
本例实现的功能是单击导入按钮将表格中的数据全部显示在ListBox中如图所示
http://developcsaicn/delphi/images/jpg>
图 将ADO中的数据导入到ListBox中
主要代码如下
procedure TFrmOrderByBtnOrderClick(Sender: TObject);
var
ID Number Name Telephone: String;
dePartMent JoinDate Old: String;
begin
ListBoxItemsClear;
ADODataSetDisableControls;
ADODataSetFirst;
while not ADODataSetEof do
begin
ID := ADODataSetFieldByName(ID)AsString;
Number := ADODataSetFieldByName(Number)AsString;
Name := ADODataSetFieldByName(Name)AsString;
Old := ADODataSetFieldByName(Old)AsString;
Telephone := ADODataSetFieldByName(Telephone)AsString;
dePartMent := ADODataSetFieldByName(dePartMent)AsString;
JoinDate := ADODataSetFieldByName(JoinDate)AsString;
ListBoxItemsAdd(ID + + Number + + Name + + Old
+ + Telephone + + dePartMent + + JoinDate);
ADODataSetNext;
end;
ADODataSetEnableControls;
end;