线程问题(200)

  • 主题发起人 主题发起人 fuyou
  • 开始时间 开始时间
F

fuyou

Unregistered / Unconfirmed
GUEST, unregistred user!
因删除了一些连接,现程序报错:ACCESS VIOLATION AT ADDRESS ....IN MODULE 'LIBMYSQL.DLL'程序如下:1、*************unit IDSX_RunSQL;interfaceuses Classes, MyAccess, SysUtils;type thdIDSXRunSQL = class(TThread) private { Private declarations } ttMSQL : TMyQuery;
protected procedure AddStartList();
procedure AddEndList();
procedure Execute;
override;
public completed : boolean;
constructor Create(MSQL : TMyQuery) ;
Virtual ;
end;
implementationuses IDSX_RptSalesQueryStatus;{ Important: Methods and properties of objects in visual components can only be used in a method called using Synchronize, for example, Synchronize(UpdateCaption);
and UpdateCaption could look like, procedure thdIDSXRunSQL.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end;
}{ thdIDSXRunSQL }constructor thdIDSXRunSQL.Create(MSQL : TMyQuery) ;
begin
inherited Create( True ) ;
ttMSQL := MSQL;
Resume;
end;
procedure thdIDSXRunSQL.AddStartList();
begin
frmIDSXRptSalesQueryStatus.RzListBox1.Add(ttMSQL.Name + ' Start At : ' + TimetoStr(Time));
end;
procedure thdIDSXRunSQL.AddEndList();
begin
frmIDSXRptSalesQueryStatus.RzListBox1.Add(ttMSQL.Name + ' End At : ' + TimetoStr(Time));
end;
procedure thdIDSXRunSQL.Execute;
begin
{ Place thread code here } completed := false;// Synchronize(AddStartList);
ttMSQL.Active := false;
ttMSQL.Active := true;// Synchronize(AddEndList);
completed := true;
end;
end.
2、***************procedure TfrmIDSXRptSellThroughBySKU.QueryData();
begin
frmIDSXRptSalesQueryStatus := TfrmIDSXRptSalesQueryStatus.Create(Self);
frmIDSXRptSalesQueryStatus.Show;
with dmIDSX_SRdo
begin
TThreadLocSts := thdIDSXRunSQL.Create(myLocSts);
TThreadStkLgr := thdIDSXRunSQL.Create(myStkLgr);
TThreadPurItem := thdIDSXRunSQL.Create(myPurItem);
TThreadPurItemOldSeason := thdIDSXRunSQL.Create(myPurItemOldSeason);
TThreadOnMarketDay := thdIDSXRunSQL.Create(myOnMarketDay);
TThreadProductMaster := thdIDSXRunSQL.Create(myProductMaster);
TThreadStkStus := thdIDSXRunSQL.Create(myStkStus);
TThreadTFCNWH := thdIDSXRunSQL.Create(myTFCNWH);
TThreadTFHKWH := thdIDSXRunSQL.Create(myTFHKWH);
TThreadTFHKShop := thdIDSXRunSQL.Create(myTFHKShop);
TThreadLastTransaction := thdIDSXRunSQL.Create(myLastTransaction);
TThreadStockCurrent := thdIDSXRunSQL.Create(myStockCurrent);
//release Access connection in time Fixed By Antonio 2008-06 try adoDBKHHL.Connected:=true;
adoQryProductMaster.Active := false;
adoQryProductMaster.Active := true;
kbmQryProductMaster.Close;
kbmQryProductMaster.LoadFromDataSet(adoQryProductMaster,[mtcpoStructure]);
kbmQryProductMaster.Open;
kbmQryProductMaster.EmptyTable;
kbmQryProductMaster.LoadFromDataSet(adoQryProductMaster,[mtcpoAppend]);
finally adoQryProductMaster.Active := false;
adoDBKHHL.Connected:=false;
end;
end;
while Truedo
begin
if ( TThreadLocSts.completed ) and ( TThreadStkLgr.completed ) and ( TThreadPurItem.completed ) and ( TThreadPurItemOldSeason.completed ) and ( TThreadOnMarketDay.completed ) and ( TThreadProductMaster.completed ) and ( TThreadStkStus.completed ) and ( TThreadTFCNWH.completed ) and ( TThreadTFHKWH.completed ) and ( TThreadTFHKShop.completed ) and ( TThreadLastTransaction.completed ) and ( TThreadStockCurrent.completed ) then
begin
TThreadLocSts.Free ; TThreadStkLgr.Free ;
TThreadPurItem.Free ;
TThreadPurItemOldSeason.Free ;
TThreadOnMarketDay.Free ;
TThreadProductMaster.Free;
TThreadStkStus.Free;
TThreadTFCNWH.Free;
TThreadTFHKWH.Free;
TThreadTFHKShop.Free;
TThreadLastTransaction.Free;
TThreadStockCurrent.Free; Break end else
begin
Sleep( 3000 ) ; Application.ProcessMessages; end ; end;
frmIDSXRptSalesQueryStatus.Close;
end;
 
版主解答下吧
 
你这个看不出错误,看看你的libmysql.dll吧。
 
后退
顶部