DBGridEH序号的自动生成

序号的自动生成
1.定义变量
  private
        maxno:integer;
  public
        bmodified:boolean;
2.写函数
  function max(const a,b:integer):integer;
  begin
    if a>b then
       result:=a
    else
       result:=b;
  end;
3 FormCreate 中加入
  bmodified:=false;
  while not adoq_rsinfo.eof do
  begin
     maxno:=max(maxno, adoq_rsinfo.fields[0].asinteger);
     adoq_rsinfo.next;
  end;
4。在你的添加按钮中加入
  adoq_rsinfo.field[0].asinteger:=maxno+1; 
---------------------
作者:paulchenbo
来源:CSDN
原文:https://blog.csdn.net/paulchenbo/article/details/1553401
版权声明:本文为博主原创文章,转载请附上博文链接!

猜你喜欢

转载自www.cnblogs.com/jijm123/p/10357054.html