ckdbh:=FormatDateTime('yymmdd', Now);
sqltxt := 'select top 1* from [wzck] order by ckid desc ';
openadoquery(dmf.ADOQuery7, sqltxt);
if dmf.ADOQuery7.RecordCount = 1 then
begin
//取出出库单编号,得到后5位的数,加00001,然后和当前日期累加;
ckdbh:=ckdbh+inttostr(StrToInt(RightStr(dmf.ADOQuery7.FieldByName('ckdh').AsString,5))+00001);
end
else
begin
ckdbh:=ckdbh+'00001';
end;
end;
select row_number() over (order by name) as rowid, sysobjects.[name] from sysobjects
select id=IDENTITY(int,1,1), sysobjects.[name] as name into dbo.Test_Table from sysobjects
var
tempYear,GetValue:string;
begin
ckdbh:=FormatDateTime('yymmdd', Now);
tempyear :=foarmatdatetime('yy',now);// 获得当时的年份
sqltxt := 'select top 1* from [wzck] order by ckid desc ';
openadoquery(dmf.ADOQuery7, sqltxt);
if dmf.ADOQuery7.RecordCount = 1 then
begin
getvalue :=trim(copy(dmf.adoquery7.fieldbyname('ckdh').asstring,0,4); //获得最大值的年份
if getvalue =tempyear then //当时本年的时候
begin
//取出出库单编号,得到后5位的数,加00001,然后和当前日期累加;
ckdbh:=ckdbh+inttostr(StrToInt(RightStr(dmf.ADOQuery7.FieldByName('ckdh').AsString,5))+00001);
end
else //是新年的时候
begin
ckdbh:=ckdbh+'00001';
end;
end;
end;
select row_number() over (order by name) as rowid, sysobjects.[name] from sysobjects
select id=IDENTITY(int,1,1), sysobjects.[name] as name into dbo.Test_Table from sysobjects
var
tempYear,GetValue:string;
begin
ckdbh:=FormatDateTime('yymmdd', Now);
tempyear :=foarmatdatetime('yy',now);// 获得当时的年份
sqltxt := 'select top 1* from [wzck] order by ckid desc ';
openadoquery(dmf.ADOQuery7, sqltxt);
if dmf.ADOQuery7.RecordCount = 1 then
begin
getvalue :=trim(copy(dmf.adoquery7.fieldbyname('ckdh').asstring,0,4); //获得最大值的年份
if getvalue =tempyear then //当时本年的时候
begin
//取出出库单编号,得到后5位的数,加00001,然后和当前日期累加;
ckdbh:=ckdbh+inttostr(StrToInt(RightStr(dmf.ADOQuery7.FieldByName('ckdh').AsString,5))+00001);
end
else //是新年的时候
begin
ckdbh:=ckdbh+'00001';
end;
end;
end;