DBGridEH序号的自动生成

来源:互联网 发布:怎样添加网络共享硬盘 编辑:程序博客网 时间:2024/04/30 06:15
序号的自动生成
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; 
原创粉丝点击