自动编号
来源:互联网 发布:软件设计师考试教材 编辑:程序博客网 时间:2024/05/17 00:08
------------------------------------------------------------三位编号
var
s,m:string;
i:integer;
begin
with query1 do
begin
close;
sql.Clear;
sql.Add('select max(记录编号) as ss from CZYB');
open;
end;
if query1.ParamByName('ss').Value=null then
s:=s+'001'
else
begin
m:=trim(query1.fieldbyname('ss').Value);
i:=strtoint(trim(copy(m,11,5)));
if i<9 then
s:=s +'00'+inttostr(i+1)
else if i<99 then
s:=s +'0'+inttostr(i+1)
else
s:=s +inttostr(i+1);
end;
label5.Caption:=s;
----------------------------------------------------------------四位编号
var
s,m:string;
i:integer;
begin
with query1 do
begin
close;
sql.Clear;
sql.Add('select max(记录编号) as ss from CZYB');
open;
end;
if query1.ParamByName('ss').Value=null then
s:=s+'0001'
else
begin
m:=trim(query1.fieldbyname('ss').Value);
i:=strtoint(trim(copy(m,11,5)));
if i<9 then
s:=s +'000'+inttostr(i+1)
else if i<99 then
s:=s +'00'+inttostr(i+1)
else if i<999 then
s:=s+'0'+inttostr(i+1)
else
s:=s +inttostr(i+1);
end;
label5.Caption:=s;
-----------------------------------------------------------------------六位编号
var
s,m:string;
i:integer;
begin
with query1 do
begin
close;
sql.Clear;
sql.Add('select max(记录编号) as ss from CZYB');
open;
end;
if query1.ParamByName('ss').Value=null then
s:=s+'000001'
else
begin
m:=trim(query1.fieldbyname('ss').Value);
i:=strtoint(trim(copy(m,11,5)));
if i<9 then
s:=s +'00000'+inttostr(i+1)
else if i<99 then
s:=s +'0000'+inttostr(i+1)
else if i<999 then
s:=s+'000'+inttostr(i+1)
else if i<9999 then
s:=s+'00'+inttostr(i+1)
else if i<99999 then
s:=s+'0'+inttostr(i+1)
else
s:=s +inttostr(i+1);
end;
label5.Caption:=s;
---------------------------------------------------------------加编码和日期的三位编号
var
s,m:string;
i:integer;
begin
s:= 'TK'+ FormatDateTime('yyyymmdd',Now()); //编码"TK",日期当天
with adotj do
begin
close;
sql.Clear;
sql.Add('select max(申请单号) as ss from TKDJ');
open;
end;
if adotj.FieldByName('ss').Value=null then
s:=s+'001'
else
begin
m:=trim(adotj.fieldbyname('ss').Value);
i:=strtoint(trim(copy(m,9,3)));
if i<9 then
s:=s +'00'+inttostr(i+1)
else if i<99 then
s:=s +'0'+inttostr(i+1)
else
s:=s +inttostr(i+1);
end;
label15.Caption:=s;
- 自动编号
- 自动编号
- 自动编号
- 自动编号
- 自动编号
- 自动编号
- 自动编号
- DataGrid的自动编号
- 重新计算自动编号
- access 自动编号复位
- DataGrid实现自动编号
- ORACLE自动编号
- 关于ACCESS自动编号
- oracle 自动编号谈
- 关于oracle自动编号
- GridView自动编号
- 触发器实现自动编号
- oracle自动编号方法
- 获得其他程序的子窗体
- 虚拟摄像头开发SDK及调用DEMO源代码,无需了解任何驱动开发或DShow即可开发自己的虚拟摄像头软件。
- inode,block,superblock的关系
- Error:NB:JAVA_HOME should point to a JDK not a JRE
- 站稳马步——(10)java I/O整理1
- 自动编号
- android的log
- 关于iphone程序代理的实现
- java.lang.IllegalArgumentException: Document base D:/appservers/apache-tomcat-6.0.20/webapps/megaeyes_enterprise_manager does no
- Edit只输数字
- ORA-01502
- 日期相关
- Pascal、C/C++、VisualBasic数据类型的对照
- [Linux][2010-11-17]memset函数