procedure TMainForm.QueryExec(mTempQuery:TADOQuery); var mError: boolean; begin while 0=0 do begin mError := False; try mTempQuery.ExecSQL; except mError := True; end; if mError then begin try mTempQuery.Connection.Connected := False; mTempQuery.Connection.Connected := True; except end; end else break; end; end;添加该过程,将原来的类似语句 AdoQuery1.SQL.Text := 'INSERT INTO ....'; AdoQuery1.ExecSQL; 改为 AdoQuery1.SQL.Text := 'INSERT INTO ....'; QueryExec(AdoQuery1);插入失败后,会不断重试,直到插入成功。如果不想出现“程序无响应”,请在该过程的相应位置加入Application.ProcessMessages;
var
mError: boolean;
begin
while 0=0 do
begin
mError := False;
try
mTempQuery.ExecSQL;
except
mError := True;
end;
if mError then
begin
try
mTempQuery.Connection.Connected := False;
mTempQuery.Connection.Connected := True;
except
end;
end
else
break;
end;
end;添加该过程,将原来的类似语句
AdoQuery1.SQL.Text := 'INSERT INTO ....';
AdoQuery1.ExecSQL;
改为
AdoQuery1.SQL.Text := 'INSERT INTO ....';
QueryExec(AdoQuery1);插入失败后,会不断重试,直到插入成功。如果不想出现“程序无响应”,请在该过程的相应位置加入Application.ProcessMessages;
我认为,是不是死锁的原因,在insert的时候,你在查询分析器用sp_who看看