unit getDsTh;interfaceuses
Classes,SConnect, DB, DBClient,Forms,SysUtils,windows;type
TgetDsTh = class(TThread)
private
{ Private declarations }
protected aaa,rrr:string; procedure Execute; override; procedure UpdateCaption; public
tmpds: TClientDataSet;
err:string;
isok , isdoend,isconn :boolean; sql:string; end;
const
conthovti = 20000;implementation
uses main;
{ 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 TsumalertTh.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end; }{ TsumalertTh }
procedure TgetDsTh.UpdateCaption;
begin
MainFrm.getthds(tmpds);
end;procedure TgetDsTh.Execute;
var
I: Integer;
tmpconn: TSocketConnection; tmpcmd: TClientDataSet;
s, randstr:string;
gettime:real;
label aa;
begin
{ Place thread code here }
randstr := varalsumrand;
tmpconn:= TSocketConnection.Create(nil) ;
tmpds:= TClientDataSet.Create(nil) ;
tmpcmd:= TClientDataSet.Create(nil) ;
tmpconn.Host := varserip ;
tmpconn.InterceptGUID := conInGUID;
tmpconn.InterceptName := conInName;
tmpconn.ServerName := conServerName;
tmpconn.ServerGUID :=conServerGUID ; tmpconn.Port := varprot;
try
tmpconn.Open ;
except err := 'T 提示:连接服务器失败!';
isok := True; gettime := GetTickCount;
while not isdoend do
begin if GetTickCount- gettime > conthovti then
begin
break;
end; application.ProcessMessages; sleep(10);
end;
try
tmpds.Free;
tmpcmd.Free ;
tmpconn.Free ;
except end; application.ProcessMessages;
exit;
end;
try application.ProcessMessages;
isconn := True;
// while True do
// begin
//
// end;
tmpds.RemoteServer := tmpconn;
tmpcmd.RemoteServer := tmpconn; tmpconn.AppServer.logsql(decstr(tmpconn.AppServer.getLog('')));
aa:
tmpds.CommandText:= sql;
tmpds.ProviderName := 'buypProv';
tmpds.Open; // Synchronize(UpdateCaption);
isok := True; gettime := GetTickCount;
while not isdoend do
begin if GetTickCount- gettime > conthovti then
begin
break;
end; application.ProcessMessages; sleep(10);
end;
tmpconn.Close ;
except on e:exception do
begin
err := 'T 提示:' + e.message ;
isok := True; gettime := GetTickCount; while not isdoend do
begin if GetTickCount- gettime > conthovti then
begin
break;
end;
application.ProcessMessages; sleep(10);
end; tmpconn.Close ;
end;
end;
try
tmpds.Free;
tmpcmd.Free ;
tmpconn.Free ;
except end;
application.ProcessMessages;
end;end. 这是取数据的程序, 但不确定 是不是 这里引起 的
Classes,SConnect, DB, DBClient,Forms,SysUtils,windows;type
TgetDsTh = class(TThread)
private
{ Private declarations }
protected aaa,rrr:string; procedure Execute; override; procedure UpdateCaption; public
tmpds: TClientDataSet;
err:string;
isok , isdoend,isconn :boolean; sql:string; end;
const
conthovti = 20000;implementation
uses main;
{ 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 TsumalertTh.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end; }{ TsumalertTh }
procedure TgetDsTh.UpdateCaption;
begin
MainFrm.getthds(tmpds);
end;procedure TgetDsTh.Execute;
var
I: Integer;
tmpconn: TSocketConnection; tmpcmd: TClientDataSet;
s, randstr:string;
gettime:real;
label aa;
begin
{ Place thread code here }
randstr := varalsumrand;
tmpconn:= TSocketConnection.Create(nil) ;
tmpds:= TClientDataSet.Create(nil) ;
tmpcmd:= TClientDataSet.Create(nil) ;
tmpconn.Host := varserip ;
tmpconn.InterceptGUID := conInGUID;
tmpconn.InterceptName := conInName;
tmpconn.ServerName := conServerName;
tmpconn.ServerGUID :=conServerGUID ; tmpconn.Port := varprot;
try
tmpconn.Open ;
except err := 'T 提示:连接服务器失败!';
isok := True; gettime := GetTickCount;
while not isdoend do
begin if GetTickCount- gettime > conthovti then
begin
break;
end; application.ProcessMessages; sleep(10);
end;
try
tmpds.Free;
tmpcmd.Free ;
tmpconn.Free ;
except end; application.ProcessMessages;
exit;
end;
try application.ProcessMessages;
isconn := True;
// while True do
// begin
//
// end;
tmpds.RemoteServer := tmpconn;
tmpcmd.RemoteServer := tmpconn; tmpconn.AppServer.logsql(decstr(tmpconn.AppServer.getLog('')));
aa:
tmpds.CommandText:= sql;
tmpds.ProviderName := 'buypProv';
tmpds.Open; // Synchronize(UpdateCaption);
isok := True; gettime := GetTickCount;
while not isdoend do
begin if GetTickCount- gettime > conthovti then
begin
break;
end; application.ProcessMessages; sleep(10);
end;
tmpconn.Close ;
except on e:exception do
begin
err := 'T 提示:' + e.message ;
isok := True; gettime := GetTickCount; while not isdoend do
begin if GetTickCount- gettime > conthovti then
begin
break;
end;
application.ProcessMessages; sleep(10);
end; tmpconn.Close ;
end;
end;
try
tmpds.Free;
tmpcmd.Free ;
tmpconn.Free ;
except end;
application.ProcessMessages;
end;end. 这是取数据的程序, 但不确定 是不是 这里引起 的
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货