L
lyshw
Unregistered / Unconfirmed
GUEST, unregistred user!
100多个idTCPClient写的客户端向IdTCPServer服务端传输数据,
服务端接收到数据后用ADO写到SQL SERVER,如何在OnExecute中连接SQL,每个客户端Thread 构造一个TADOConnection吗?
这样的需求该如何设计?
procedure TMainForm.IdTCPServer1Execute(AThread: TIdPeerThread);
var
AData: TMemoryStream;
begin
AData:= TMemoryStream.Create;
try
AThread.Connection.ReadStream(AData, -1, False);
if SaveToDB(AData) then
//SaveToDB函数该如何写??
AThread.Connection.WriteLn(DATA_SAVE_SUCCESS)
else
AThread.Connection.WriteLn(DATA_SAVE_FAIL);
finally
AData.Free;
AThread.Connection.Disconnect;
end;
end;
服务端接收到数据后用ADO写到SQL SERVER,如何在OnExecute中连接SQL,每个客户端Thread 构造一个TADOConnection吗?
这样的需求该如何设计?
procedure TMainForm.IdTCPServer1Execute(AThread: TIdPeerThread);
var
AData: TMemoryStream;
begin
AData:= TMemoryStream.Create;
try
AThread.Connection.ReadStream(AData, -1, False);
if SaveToDB(AData) then
//SaveToDB函数该如何写??
AThread.Connection.WriteLn(DATA_SAVE_SUCCESS)
else
AThread.Connection.WriteLn(DATA_SAVE_FAIL);
finally
AData.Free;
AThread.Connection.Disconnect;
end;
end;