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;