Delphi 获取临时数据集 ClientDataSet

Posted jijm123

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Delphi 获取临时数据集 ClientDataSet相关的知识,希望对你有一定的参考价值。

function GetcdsAccountsData: OleVariant;
  var ASQLQuery: TSQLQuery;
      Adsp: TProvider;
  begin
    ASQLQuery:=CreateSQLQuery;
    Adsp:=TProvider.Create(nil);
    with ASQLQuery do try
      SQL.Add(Select AccID, pAccID, AccName, AccFullName, Explan, Grade, Property, Detailed, DC, SublegType);
      SQL.Add(,DeptAcc, EmplAcc, CorpAcc, ItemAcc, pItemID, Fcy, FcyNo, FcyExrate);
      SQL.Add(,Qty, QtyUnit, QtySpecs, QtyPrice,QDigits, PDigits, FDigits);
      SQL.Add(from Accounts);
      SQL.Add(where SysID=:SysID and Status=‘‘A‘‘);
      SQL.Add(and accYear=:accYear);
      SQL.Add(Order by AccID);
      ParamByName(SysID).AsInteger:=FSysID;
      ParamByName(accYear).AsInteger:=FLoginDate.Year;
      Adsp.DataSet:=ASQLQuery;
      Result:=Adsp.Data;
    finally
      Adsp.Free;
      Free;
    end;
  end;

  function CheckOpencdsAccounts: Boolean;
  begin
    if FcdsAccounts=nil then
      FcdsAccounts:=TClientDataSet.Create(Self);
    with FcdsAccounts do begin
      if not Active then begin
        Data:=GetcdsAccountsData;
        IndexFieldNames:=AccID;
      end;
      Result:=Active;
    end;
  end;

 

以上是关于Delphi 获取临时数据集 ClientDataSet的主要内容,如果未能解决你的问题,请参考以下文章