码迷,mamicode.com
首页 > 其他好文 > 详细

tfield的字段名和显示名

时间:2020-01-09 10:17:47      阅读:94      评论:0      收藏:0      [点我收藏+]

标签:RoCE   roc   sse   spl   private   名称   win   with   classes   

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的字段名和显示名

标签:RoCE   roc   sse   spl   private   名称   win   with   classes   

原文地址:https://www.cnblogs.com/tobetterlife/p/12169821.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!