获取 临时数据集 的两种方法
procedure GetEmplData; var ASQLQuery:TSqlQuery; ADsp:TDatasetProvider; begin ASQLQuery:=TSqlQuery.Create(nil); ADsp:=TDatasetProvider.Create(nil); with ASQLQuery do try Close;SQL.Clear; SQLConnection:=SQLConn; SQL.Add('Select EmplNo, Empl From Empl'); Adsp.DataSet:=aSqlQuery; cdsEmpl.Data:=adsp.Data; finally ADsp.Free; ASQLQuery.Free; end; end;
procedure InitLookUpSource; var CmdText : WideString; begin CmdText:='Select Corpid, CorpNo, SName from Corps'+#13#10 +'where SysID='+IntToStr(FSysID)+#13#10 with rds_cdsCorps do begin Data:=GetDataText(CmdText, '', [], CmdText); AddIndex('Index1', 'CorpID', [], '', '', 0); IndexName:='Index1'; end; end;