D
darlingpeng
Unregistered / Unconfirmed
GUEST, unregistred user!
为什么我的代码有一行不能编译,代码本身没有错误啊
msql6:='select * from txt_tmp1';
with ADOQuery4 do begin
ADOQuery4.Close;
ADOQuery4.SQL.Clear;
ADOQuery4.SQL.Add(msql6);
ADOQuery4.Open;
while not eof do begin
a1:=ADOQuery4.fieldbyname('a1').AsString;
b1:=copy(a1,1,6);
c1:='create';
if b1=c1 then begin
n:=n+1; //可以编译
end;
next;
end;
end;
为什么下面的代码基本一样但是不能编译呢
for i:=1 to n do begin
k:=0;
msql3:='select * from txt_tmp1';
with ADOQuery5 do begin //
ADOQuery5.Close;
ADOQuery5.SQL.Clear;
ADOQuery5.SQL.Add(msql3);
ADOQuery5.Open;
while not eof do begin
d1:=ADOQuery5.fieldbyname('a1').AsString;
//l:=l+1;
e1:=copy(d1,1,6);
f1:='create';
if e1=f1 then
begin
// inc(k);
a0:=ADOQuery5.fieldbyname('a0').AsInteger;
k:=k+1; //不能编译,自动跳过这行代码,我找了很久,没找到原因,请大侠们帮帮忙
end;
next;
j:=j+1;
end;
end;//
end;
msql6:='select * from txt_tmp1';
with ADOQuery4 do begin
ADOQuery4.Close;
ADOQuery4.SQL.Clear;
ADOQuery4.SQL.Add(msql6);
ADOQuery4.Open;
while not eof do begin
a1:=ADOQuery4.fieldbyname('a1').AsString;
b1:=copy(a1,1,6);
c1:='create';
if b1=c1 then begin
n:=n+1; //可以编译
end;
next;
end;
end;
为什么下面的代码基本一样但是不能编译呢
for i:=1 to n do begin
k:=0;
msql3:='select * from txt_tmp1';
with ADOQuery5 do begin //
ADOQuery5.Close;
ADOQuery5.SQL.Clear;
ADOQuery5.SQL.Add(msql3);
ADOQuery5.Open;
while not eof do begin
d1:=ADOQuery5.fieldbyname('a1').AsString;
//l:=l+1;
e1:=copy(d1,1,6);
f1:='create';
if e1=f1 then
begin
// inc(k);
a0:=ADOQuery5.fieldbyname('a0').AsInteger;
k:=k+1; //不能编译,自动跳过这行代码,我找了很久,没找到原因,请大侠们帮帮忙
end;
next;
j:=j+1;
end;
end;//
end;