我设计的自动编号但是运行时,出现DBedit11,field'sczj'找不到,我把DBedit11
删了以后,又出现Dbedit10 'field' 找不到;。。
请各位高手解释一下:谢谢! 这是自动编号代码:
DateTimeToString(result,'yy',now());
year1:=strtoint(result);
No:=result; // Äꣻ DateTimeToString(result,'mm',now());
month1:=strtoint(result);
if month1>10 then
no:=no+inttostr(month1);
if month1<10 then
no:=no+'0'+inttostr(month1);//ÔÂ DateTimeToString(result,'dd',now());
Day1:=strtoint(result);;
if Day1>=10 then
no:=no+inttostr(day1);
if Day1<10 then
no:=no+'0'+inttostr(day1); //Ìì
adoquery1.Close ;
adoquery1.SQL.Clear ;
adoquery1.SQL.Add('select max(dh) from khda');
adoquery1.Open ;
if adoquery1.fields[1].AsString<>'' then
begin
s:=copy(adoquery1.fields[1].AsString,11,3);
q:=strtoint(s)+1;
i:=2-length(inttostr(q));
s:=inttostr(q);
for j:=1 to i do
begin
s:='0'+s;
end;
adoquery1.FieldByName('dh').AsString :=no+'_'+s;
end
else
begin
adoquery1.FieldByName('dh').AsString :=no+'_'+'001';
end;
end;
删了以后,又出现Dbedit10 'field' 找不到;。。
请各位高手解释一下:谢谢! 这是自动编号代码:
DateTimeToString(result,'yy',now());
year1:=strtoint(result);
No:=result; // Äꣻ DateTimeToString(result,'mm',now());
month1:=strtoint(result);
if month1>10 then
no:=no+inttostr(month1);
if month1<10 then
no:=no+'0'+inttostr(month1);//ÔÂ DateTimeToString(result,'dd',now());
Day1:=strtoint(result);;
if Day1>=10 then
no:=no+inttostr(day1);
if Day1<10 then
no:=no+'0'+inttostr(day1); //Ìì
adoquery1.Close ;
adoquery1.SQL.Clear ;
adoquery1.SQL.Add('select max(dh) from khda');
adoquery1.Open ;
if adoquery1.fields[1].AsString<>'' then
begin
s:=copy(adoquery1.fields[1].AsString,11,3);
q:=strtoint(s)+1;
i:=2-length(inttostr(q));
s:=inttostr(q);
for j:=1 to i do
begin
s:='0'+s;
end;
adoquery1.FieldByName('dh').AsString :=no+'_'+s;
end
else
begin
adoquery1.FieldByName('dh').AsString :=no+'_'+'001';
end;
end;
是不是你的永久字段中没有添加这个字段呢