delphi OleVariant转换RecordSet

uses Data.Win.ADODB;

function varToRecordSet( parms : OleVariant )  : Data.Win.ADODB._Recordset;
begin
Result := IDispatch( parms ) as Data.Win.ADODB._Recordset; end; function RecordSetToVar( prs : _Recordset ) : OleVariant; begin
Result := prs;
end;
function recordSetToXMLString(prs:winapi.ADOInt._Recordset): string;
var
astr:string;
stream:TStringStream;
begin
stream := TStringStream.Create(''); prs.Save(TStreamAdapter.Create(stream) as IUnknown,adPersistXML);
stream.Position:=;
astr:=stream.DataString;
stream.Free;
Result := astr; end; function xmlStringToRecordSet(pxml:string): _Recordset;
var
drs:Data.Win.ADODB._Recordset;
irs:winapi.ADOInt._Recordset;
RS: Variant;
stream:TStringStream;
begin
stream := TStringStream.Create(pxml);
stream.Position:=;
RS := CreateOleObject('ADODB.Recordset');
RS.Open(TStreamAdapter.Create(stream) as IUnknown); Result := IUnknown(RS) as winapi.ADOInt._Recordset;
end;

ids: IDispatch;

ADODataSet1.Recordset :=  ids  as _Recordset;

05-11 22:06