zoukankan      html  css  js  c++  java
  • 查找某特定Recid行的主索引值

     1 static void FindPrimaryIdx(Args _args)
     2 {
     3      DictTable       dt;
     4      DictIndex       di;
     5      Common          cm;
     6      IndexID         idx;
     7      int             i, iCnt;
     8      FieldID         fid;
     9      FieldID         fids[,10];
    10      int             fidsCnt = 0;
    11      str             s;
    12      str             sTemp;
    13      int             _tID=175,_rID=956968;//可以修改或使用参数传递
    14      ;
    15 
    16      dt  = new DictTable(_tid);
    17      if (dt) 
    18    {
    19          idx = dt.primaryIndex();
    20          if (idx) {
    21              di = dt.indexObject(idx);
    22              if (di) {
    23                  iCnt = di.numberOfFields();
    24                  for (i = 1; i <= iCnt; i++) {
    25                      fid = di.field(i);
    26                      if (fid) {
    27                          fidsCnt++;
    28                          fids[fidsCnt] = fid;
    29                      }
    30                  }
    31              }
    32          }
    33          cm = dt.makeRecord();
    34          select firstonly * from cm
    35          where cm.RecId == _rid;
    36          if (cm.RecId) {
    37              // 找不到记录
    38              for (i = 1; i <= fidscnt; i++) {
    39                  fid   = fids[i];
    40                  sTemp = strfmt('[%1]=[%2]',fieldId2Name(_tid, fid),cm.(fid));
    41                  if (s) s = s+',';
    42                  s = s + sTemp;
    43                  info(s);
    44              }
    45          }
    46      }
    47 }
  • 相关阅读:
    HDU1864--01背包
    HDU4508--完全背包
    HDU5410--01背包+完全背包
    HDU1284--完全背包
    HDU1248--完全背包
    HDU2191--多重背包(二进制分解+01背包)
    HDU2186--水
    PAT乙级--1003
    51Nod--1006 lcs
    51Nod--1008
  • 原文地址:https://www.cnblogs.com/Jinnchu/p/2663273.html
Copyright © 2011-2022 走看看