碰到一个很麻烦的事
procedure RecordsetToStream(const Recordset: _Recordset;var MStream:TMemoryStream);
var
RS: Variant;
begin
if Recordset=nil then Exit;
try
RS:=CreateOleObject('ADODB.Recordset');
RS:=Recordset;
MStream.Position:=0;
RS.Save(TStreamAdapter.Create(Mstream) as IStream, adPersistADTG); //adPersistXML
finally
end;
end;
将ADO的记录集转化为流,5万条数据要16秒,可将它存为文件只要1.6秒,RS.Save(TStreamAdapter.Create(Mstream) as IStream, adPersistADTG); //adPersistXML
这句耗时,我认为是IStream接口的问题,
不想用TClientDataSet(不支持nvarchar),请问高手有没有解决办法