美
美国提子
Unregistered / Unconfirmed
GUEST, unregistred user!
QueryPool := TQuery.Create(nil);
QueryPool.DatabaseName := FDatabaseName;
QueryDev := TQuery.Create(nil);
QueryDev.DatabaseName := FDatabaseName;
with QueryPooldo
begin
Sql.Add('select * from Pool');
Sql.Add('where (PoolState = 1) and (PoolType <> ''1'')');
Open;
while not Eofdo
begin
with QueryDevdo
begin
Close;
//当地三次循环这里时,提示出错,下面语句sql语句也一样出错
//如果Synchronize(Close)就不会出错
//但Synchronize(Sql.Clear)根本就没有清除Sql,
//Synchronize(Open)也查不出任何记录
Sql.Clear;
Sql.Add('select * from PoolDevice');
Sql.Add('where PoolID = '+QueryPool.FieldByName('PoolID').AsString);
Open;
end;
end;
出错现象:跳出cpu窗口计出错信息:
Project Hymms.exe faulted with message: 'access violation at 0x4da2ed3d: read of address
0xfff6d6ec'. Process Stopped. Use Step or Run to continue
用Synchronize(过程名)
过程中进行with Query操作,根本就不会执行这个过程
QueryPool.DatabaseName := FDatabaseName;
QueryDev := TQuery.Create(nil);
QueryDev.DatabaseName := FDatabaseName;
with QueryPooldo
begin
Sql.Add('select * from Pool');
Sql.Add('where (PoolState = 1) and (PoolType <> ''1'')');
Open;
while not Eofdo
begin
with QueryDevdo
begin
Close;
//当地三次循环这里时,提示出错,下面语句sql语句也一样出错
//如果Synchronize(Close)就不会出错
//但Synchronize(Sql.Clear)根本就没有清除Sql,
//Synchronize(Open)也查不出任何记录
Sql.Clear;
Sql.Add('select * from PoolDevice');
Sql.Add('where PoolID = '+QueryPool.FieldByName('PoolID').AsString);
Open;
end;
end;
出错现象:跳出cpu窗口计出错信息:
Project Hymms.exe faulted with message: 'access violation at 0x4da2ed3d: read of address
0xfff6d6ec'. Process Stopped. Use Step or Run to continue
用Synchronize(过程名)
过程中进行with Query操作,根本就不会执行这个过程