zoukankan      html  css  js  c++  java
  • Dbgrid 中表字段所在的列序号

    //--------------------------------------------------------------------------------
    // 功能:返回表字段在 DBGrid 列中的序号,首序号为0
    // 参数: pDbGrid:TDbGrid;        DBGrid
    //               pcFieldName : string    数据表字段名,

    W{ifT03垠%h[

    字段名不区分大小写
    // 返回:当表字段在 DBGrid 中存在时,返回表字段所在的列的序号,首序号为0
    //             否则,$=+HyICk%V",n?Z8G#G=hM返回 -1
    //例子:DbGrid1.SelectedIndex := GetDbGridColumnIndex( DbGrid1, ''''Price''''  );
    //--------------------------------------------------------------------------------
    Function GetDbGridColumnIndex( pDbGrid:TDbGrid; pcFieldName : string  ):integer;
    var nFldLoop : integer ;
        cFldName : string ;
    begin
      Result := -1 ;
      For nFldLoop := 0 to pDbGrid.Columns.Count-1 do
      begin
          cFldName := pDbGrid.Columns[nFldLoop].FieldName ;
          If uppercase(pcFieldName) = uppercase( cFldName ) then
          begin
             Result := nFldLoop ;
             exit ;
          end;
      end;
    end;

    例子:

        DbGrid1.SelectedIndex := GetDbGridColumnIndex( DbGrid1, ''''Price''''  );
        将DbGrid1的当前列定位到字段Price上。[!-国]1{:UwO理gVF)育专业H*#C;中垠h

  • 相关阅读:
    localStorage cache
    webpack的学习过程
    npm install --save/--save-dev的区别
    .gitignore常见问题
    jQuery的优点与缺点
    JSONP是什么
    Node.js-Usage & Example
    【转】Swig Getting Started
    【转】使用Spring MVC统一异常处理实战
    C++-Qt【5】-QT的QString,char*,QByteArray转化以及中文乱码的问题
  • 原文地址:https://www.cnblogs.com/martian6125/p/9631570.html
Copyright © 2011-2022 走看看