奇怪的问题???
procedure TF_ADD.FormCreate(Sender: TObject);
var i,max_id:string;
begin
with tquery.Create(self) do
begin
databasename:='dd2100';
sql.add('select max(id) from zlgl_khzl');
active:=true;
i:=fields[0].asstring;
free;
end;
if i=''then
max_id:='000100000001' //'00'+current_xz_code+'00000001'
else
begin
max_id:='000'+inttostr(strtoint(copy(i,4,9))+1);
// edit1.Text:=max_id;
// max_id:='ytrht';
end;
end;
这里 i 从数据库中点出
有的时候max_id 值为000100000004,
有的时候max_id为空,max_id为空时, i 也为空!!!
请问为什么?