易截截图软件、单文件、免安装、纯绿色、仅160KB

delphi自动生成流水号

想使用delphi自动生成“年后两位+月份+四位编号”的流水号
现新增第一条记录的时候能生成
第二条的时候流水号的最后一位就没了
大家帮忙看看我的代码错在哪里
  Delphi(Pascal) code:

procedure TForm1.FormCreate(Sender: TObject);
var
i:Real;
newid:string;
begin
with ADOQuery1 do
begin
Close;
SQL.Clear;
SQL.Add(' select * from JYBB where id like '+''''+FormatDateTime('YYMM',Now())+'%'+'''');
Open;
if ADOQuery1.IsEmpty then
newid:=formatdatetime('YYMM',Now())+'0001'
else
begin
Close;
SQL.Clear;
SQL.Add('select max(id)+1 as i from JYBB where left(id,4)='''+FormatDateTime('YYMM',Now())+'''') ;
Open;
newid:=FormatDateTime('YYMM',Now())+ FormatFloat('000',i);
end;
Edit3.Text:=newid;
end;
end;



FormatFloat('0000',i);


引用
FormatFloat('0000',i);


还是不行,加了后生成的是09100000

FormatFloat('0000',ADOQuery1.FieldByName('i').asInterger);

FormatFloat('0000',ADOQuery1.FieldByName('i').asInteger);

你返回的 i 是正确的吗? 这种问题单步跟就应该能定位到出问题的语句。


showmessage(ADOQuery1.


相关问答:

delphi内置的加密解密单元是哪个?

delphi内置的加密解密单元是哪个?
Delphi有内置加密解密单元?

delphi里有个加密和解密的单元

引用
delphi里有个加密和解密的单元


是哪个?

windows的api?

标准加密的源代码,网上 ......

如何使DELPHI程序出现UAC盾牌?

因为是WIN7系统,程序运行时有的设置需要触及到UAC。

但是网上找的方法都不行,有的方法使用了根本没反应;另外虽然能产生uac盾牌,但在编译时会出现一个错误:

[DCC Error] E2161 Warning: Duplicate ......

delphi中的dbchart中的饼形图怎么是一条直线

dbchart中的饼形图。无法显示。下面是代码。
      with adoquery2 do
      begin
        close;
        sql.clear;
&nb ......

delphi中我设置了多个checkbox,怎么设置只能选一个。

问题1。delphi中我设置了多个checkbox(checkbox1,checkbox2,checkbox3),怎么设置只能选checkbox2。
问题2。我根据选择运行完后,再想选择别的checkbox3时怎么取消原来的选择checkbox2.


1、单选建议改用 ......

delphi的dll中自定义的类如何在调用程序中实例化?

Delphi(Pascal) code:
unit Unit1;
interface
type
Module=class
published
function ReadTest: integer;
procedure WriteTest(const Value: integer);
published
property Test:integ ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号