F
fanshiyou
Unregistered / Unconfirmed
GUEST, unregistred user!
objAdodsData := TADODataSet.Create(nil);
objDsp := TDataSetProvider.Create(nil);
objADOConn := GobjADOConnectPool.LockADOConn;
try try objAdodsData.Connection := objADOConn;
objAdodsData.CommandText := AstrSQL;
objAdodsData.CommandTimeout := 120;
objAdodsData.Open;
for iIndex := 0 to objAdodsData.FieldCount - 1do
begin
objAdodsData.Fields[iIndex].ReadOnly := False;
end;
objDsp.DataSet := objAdodsData;
GbIsConnected := true;
except on E : Exceptiondo
begin
GbIsConnected := false;
IniConnect( Gstr_ServerIP, Gstr_DataBaseName, Gstr_UserName, Gstr_PWD, Gstr_Guid, Gint_Port );
Raise Exception.Create('网络被断开,请重新登陆.具体原因:' + E.Message);
end;
end;
Result := objDsp.Data;
finally FreeAndNil(objAdodsData);
FreeAndNil(objDsp);
GobjADOConnectPool.UnLockADOConn( objADOConn );
objADOConn := nil;
end;
用FastMM4测试时,会提示有一个内存泄露 189-204bytes :unknown * 1。程序因为是服务端程序,过几天就会因内存不足要重启,有那位大哥,能解决的帮一下小弟。万分感激
objDsp := TDataSetProvider.Create(nil);
objADOConn := GobjADOConnectPool.LockADOConn;
try try objAdodsData.Connection := objADOConn;
objAdodsData.CommandText := AstrSQL;
objAdodsData.CommandTimeout := 120;
objAdodsData.Open;
for iIndex := 0 to objAdodsData.FieldCount - 1do
begin
objAdodsData.Fields[iIndex].ReadOnly := False;
end;
objDsp.DataSet := objAdodsData;
GbIsConnected := true;
except on E : Exceptiondo
begin
GbIsConnected := false;
IniConnect( Gstr_ServerIP, Gstr_DataBaseName, Gstr_UserName, Gstr_PWD, Gstr_Guid, Gint_Port );
Raise Exception.Create('网络被断开,请重新登陆.具体原因:' + E.Message);
end;
end;
Result := objDsp.Data;
finally FreeAndNil(objAdodsData);
FreeAndNil(objDsp);
GobjADOConnectPool.UnLockADOConn( objADOConn );
objADOConn := nil;
end;
用FastMM4测试时,会提示有一个内存泄露 189-204bytes :unknown * 1。程序因为是服务端程序,过几天就会因内存不足要重启,有那位大哥,能解决的帮一下小弟。万分感激