N
newhfy
Unregistered / Unconfirmed
GUEST, unregistred user!
中间层代码
procedure Tcom_test.applydata(vdata1, vdata2: OleVariant);
var
ierror:integer;
begin
try
if not (VarIsNULL(vData1) or VarIsEmpty(vData1)) then
DataSetProvider1.ApplyUpdates(vdata1,0,ierror);
if not (VarIsNULL(vData2) or VarIsEmpty(vData2)) then
datasetprovider2.ApplyUpdates(vdata2,0,ierror);
SetComplete;
except
SetAbort;
Raise Exception.Create('数据保存失败!');
end;
end;
客户端
var
vData11,vData21:OleVariant;
begin
if clientdataset1.ChangeCount>0 then
vData11:=clientdataset1.Delta;
if clientdataset2.ChangeCount>0 then
vData21:=clientdataset2.Delta;
DCOMConnection1.AppServer.applydata(vData11,vData21);
end;
用以上语句修改后保存出错,说内存(read)错误,但将
DCOMConnection1.AppServer.applydata(vData11,vData21);
直接改为
DCOMConnection1.AppServer.applydata(clientdataset1.Delta,clientdataset2.Delta);
就可以了,为什么不能将clientdataset.delta赋于OleVariant变量中呢?
procedure Tcom_test.applydata(vdata1, vdata2: OleVariant);
var
ierror:integer;
begin
try
if not (VarIsNULL(vData1) or VarIsEmpty(vData1)) then
DataSetProvider1.ApplyUpdates(vdata1,0,ierror);
if not (VarIsNULL(vData2) or VarIsEmpty(vData2)) then
datasetprovider2.ApplyUpdates(vdata2,0,ierror);
SetComplete;
except
SetAbort;
Raise Exception.Create('数据保存失败!');
end;
end;
客户端
var
vData11,vData21:OleVariant;
begin
if clientdataset1.ChangeCount>0 then
vData11:=clientdataset1.Delta;
if clientdataset2.ChangeCount>0 then
vData21:=clientdataset2.Delta;
DCOMConnection1.AppServer.applydata(vData11,vData21);
end;
用以上语句修改后保存出错,说内存(read)错误,但将
DCOMConnection1.AppServer.applydata(vData11,vData21);
直接改为
DCOMConnection1.AppServer.applydata(clientdataset1.Delta,clientdataset2.Delta);
就可以了,为什么不能将clientdataset.delta赋于OleVariant变量中呢?