function GetNoDateMaxNo(ADOQueryTmp:TADOQuery; var mMaxNo:string; mTable:string; mFlag:string; lsLen:integer=3):Boolean; begin try with ADOQueryTmp do begin Close; sql.Clear ; sql.Add('exec XC_TableNoDateDH'); sql.Add(quotedStr(mTable)); sql.Add(','+quotedStr(mFlag)); sql.Add(','+intTostr(LsLen)); Open; if RecordCount>0 then begin mMaxNo:=trim(fieldByName('DepotShow').AsString) ; if mMaxNo<>'' then result:=true else Result:=false; end else begin result:=false; end; end; if not Result then application.MessageBox(Pchar('无法生成自动编号('+mflag+')'),'提示信息',MB_ICONINFORMATION); Except result:=false; application.MessageBox(Pchar('无法生成自动编号('+mflag+')'),'提示信息',MB_ICONINFORMATION); end; end;