delphi-dbgrid取得所有表中的值


本文整理自网络,侵删。

 

把当前dbgrid的值的第一个值(id)全部写到了一个tstringlist了

 

var tlist:TStringlist;

s_tmp:string;
icount,i:integer;
begin
tlist:=TStringlist.Create;
icount:=TStringGrid(DBGrid1).RowCount-1;
with dbgrid1.datasource.dataset do
begin
for i := 0 to icount -1 do
begin
recno:=i+1;
s_tmp:=DBGrid1.Fields[0].DisplayText;
tlist.Add(s_tmp);
end;
end;
result.Text:=tlist.Text;
tlist.Free;

 

 

 

 

相关阅读 >>

Delphi firemonkey在画布上绘制 imagelist图像

Delphi tfilestream 流操作2

Delphi中编写无输出函数名的dll文件

Delphi new 为指针分配内存空间

windows api 的数据类型与 Delphi 数据类型对照表

Delphi 加载excel 导入数据库

Delphi 检测网络是否连通

Delphi listbox模糊查找文字

Delphi xe10 获取屏幕截图

Delphi 三种方式读取txt文本文件

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...