tfield的字段名和显示名
Posted tobetterlife
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tfield的字段名和显示名相关的知识,希望对你有一定的参考价值。
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Grids, DBGrids, DB, ADODB, StdCtrls; type TForm1 = class(TForm) btn1: TButton; edt1: TEdit; edt2: TEdit; ds1: TDataSource; qry1: TADOQuery; con1: TADOConnection; dbgrd1: TDBGrid; btn2: TButton; edt3: TEdit; edt4: TEdit; edt5: TEdit; procedure btn1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.btn1Click(Sender: TObject); begin with qry1 do begin Close; sql.Text:= ‘select * from dbo.TB_xxxx‘; open; end; qry1.First; edt1.Text:= qry1.Fields[0].Text; edt2.Text:= qry1.Fields[0].Value; qry1.Fields[0].DisplayLabel:= ‘编号嘿嘿‘; edt3.Text:= qry1.Fields[0].DisplayText;//readonly edt4.Text:= qry1.Fields[0].DisplayLabel;//ok显示编号嘿嘿这个名称 edt5.Text:= qry1.Fields[0].DisplayName;//readonly edt2.Text:= qry1.Fields[0].Value; edt2.Text:= qry1.Fields[0].FieldName; //ok显示sBH这个字段名 end; end.
以上是关于tfield的字段名和显示名的主要内容,如果未能解决你的问题,请参考以下文章