例如我想生成000001,000002,000003.......010000 之间的号码并插入到数据库中如何写?000001 填在edit1 中 010000填在edit2中,点"生成"按钮自动生成数据并插入到adoquery1中
解决方案 »
- 菜鸟问题,数据类型错误求助
- 谁帮我把下面这段代码译成delphi,谢谢!
- 如何来释放窗体的关闭事件
- 关于判断字符串长度简单的问题
- Translate??????????????????????????????????
- 如何实现DVD左右声道的控制 用代码
- 数据库+DLL=Exception (内容涉及VCL, API, DB三个方面),晕!
- 谁有Delphi+COM的实例?或者书籍
- 快救救我,已经搞了快两天了????高分送上
- 难!电子考试时,如何防止学生通过网络邻居作弊?
- 为什么我用richedit把文本读入显示出来以后,再另存为文本的时候,文件内容会变化,加了很多字符?谁帮帮我?多谢了
- 我想从一个FTP站点下载文件,希望能批处理,用程序实现,而不是手工下载。谢谢
begin
s := '00000'+IntToStr(i);
s := RightStr(s, 6); //s is what you want
//add s to DB here
end;uses Strutils;http://lysoft.7u7.net
i,Num:integer;
s:string;
begin
for i:=Inttostr(Edit1.text) to Inttostr(Edit2.text) do begin
Num:=Length(Edit1.Text)-Length(IntToStr(i));
case Num of
1: s:='0'+IntToStr(i);
2: s:='00'+IntToStr(i);
.
.
end;
With Query do begin
Edit;
FieldByName('FileName').Value:=s;
Post;
end;
end;
end;
i, j, edit1len: integer;
sstr:string;
begin
edit1len:=length(edit1.text);
for i:= strtoint(edit1.text) to strtoint(edit2.Text) do
begin
with ADOQuery1 do
begin
sstr:='';
for j:=0 to (edit1len - length(inttostr(i)) -1 ) do
sstr:= sstr + '0';
Insert;
FieldByName('YourNumber').AsString:= sstr + inttostr(i);
Post;
end;
end;