zoukankan      html  css  js  c++  java
  • 和Ares的对话(关于更新当前记录)

    temperature010203
    Ares 15:02:10
    Check(DSCursor.ModifyRecord(ActiveBuffer));
    Mofen 14:58:06
    就这样OK了?
    Mofen 14:58:25
    谢谢了
    Mofen 14:58:32
    我试一下。:)
    Ares 15:02:54
    function TAcbsClientDataSet.LoadBlobData(FieldName: string): boolean;
    var
      F1, F2 : TField;
      V : Variant;
      Stream, Stream1 : TStream;
    begin
      Result := False;
      F1 := FindField(FieldName);
      if not F1.IsNull then
        Exit;

      F2 := FindField(Copy(FieldName, 1, Length(FieldName) - 4));
      if (F1 <> nil) and (F2 <> nil) and (F2 is TNumericField) and (F2.AsInteger > 0) then
      begin
        Check(DSBase.SetProp(dspropLOGCHANGES, Integer(False)));
        try
          V := Service.GetBlobData(F2.AsInteger);
          if not VarIsNull(V) then
          begin
            UpdateCursorPos;
            Stream := TAcbsUtils.VariantToStream(V);
            Stream1 := Self.CreateBlobStream(F1, bmRead);
            try
              Stream.Position := 0;
              TAcbsClientBlobStream(Stream1).Truncate;
              Stream1.CopyFrom(Stream, Stream.Size);
              Result := True;
            finally
              Stream.Free;
              Stream1.Free;
            end;
            Check(DSCursor.ModifyRecord(ActiveBuffer));
          end;
        finally
          Check(DSBase.SetProp(dspropLOGCHANGES, Integer(True)));
        end;
      end else
        Result := False;
    end;
    Ares 15:03:35
    要自己写个控件,修改ActiveBuffer就好了
    Mofen 14:59:14

    Mofen 14:59:21

    Mofen 14:59:56
    我想做个刷新当前记录的方法
    Ares 15:17:50
    那个更简单啊
    Mofen 15:13:59
    是怎么做的?
    Mofen 15:14:12
    我打算手动从数据库里面重新取过
    Ares 15:18:51
    function Refresh(               { Refresh dataset }
            NewPacket    : PSafeArray;  { New updated packet }
            iClientData  : LongWord;       { Client data }
            pfReconcile  : pfDSReconcile { Callback for resolving conflicts }
        ): DBResult; stdcall;
    Mofen 15:15:11
    这个是你自己写的吗?
    Ares 15:19:50
    DSCursor.RefreshRecord(VarToDataPacket(NewData))
    Ares 15:19:57
    DsIntf里的
    Ares 15:20:19
    function RefreshRecord( { Refresh details/blobs for this record, and all
                                 'current' records above, if any }
            Packet  : PSafeArray        { New updated pickle }
        ): DBResult; stdcall;
    Mofen 15:16:22
    哦,我这个cds可能不能这样做
    Mofen 15:16:41
    我的手动赋值data的
    Ares 15:21:40
    我们基本也是手动的
    Ares 15:21:59
    直接用的TClientDataSet吗?
    Mofen 15:17:51
    那你刷新当前记录用的是哪个呢?
    Mofen 15:17:57
    不是,继承了
    Ares 15:23:34
    1:获取需要刷新的数据包
    2:按TclientDataSet的internalFetch方法写刷新
    Mofen 15:20:25
    好,3Q,我现在去试下。


    procedure TCustomClientDataSet.InternalFetch(Options: TFetchOptions);
    var
      DataPacket: TDataPacket;
      NewData: OleVariant;
      BaseDS: TCustomClientDataSet;
    begin
      { Throw error if we are closed, but not if we are in the middle of opening }
      if not Assigned(DSCursor) then CheckActive;
      UpdateCursorPos;
      Check(DSCursor.GetRowRequestPacket(foRecord in Options, foBlobs in Options,
        foDetails in Options, True, DataPacket));
      DataPacketToVariant(DataPacket, NewData);
      BaseDS := Self;
      while Assigned(BaseDS.FParentDataSet) do BaseDS := BaseDS.FParentDataSet;
      NewData := BaseDS.DoRowRequest(NewData, Byte(Options));
      UpdateCursorPos;
      Check(DSCursor.RefreshRecord(VarToDataPacket(NewData)));
      if not Active then Exit;
      DSCursor.GetCurrentRecord(ActiveBuffer);
      if Options = [foDetails] then
        DataEvent(deDataSetChange, 0);
    end;

  • 相关阅读:
    CODING DevOps 系列课程重磅来袭!
    CODING 敏捷实战系列加餐课:CODING 做敏捷这一年
    IdentityServer4 QuickStart 授权与自定义Claims
    .NET项目升级:可为空引用
    ASP.NET CORE WEBAPI文件下载
    xunit测试无法找到testhost或没有可用测试的问题解决方法
    强迫症福利--收起.NET程序的dll来
    使用高性能Pipelines构建.NET通讯程序
    ASP.NET Core使用TopShelf部署Windows服务
    .NET Standard库引用导致的FileNotFoundException探究
  • 原文地址:https://www.cnblogs.com/DKSoft/p/875282.html
Copyright © 2011-2022 走看看