H
houfuzhu1982
Unregistered / Unconfirmed
GUEST, unregistred user!
我用缓存的方式来做主从表,主表数据可以正常提交
从表数据可以正常添加(是在断开主从关系的情况下),但就是不能提交到
后台,请大侠指点一下,问题在哪里,已经搞了好几个日日夜夜了,救救我吧
主表属性:LockType:=ltBatchOptimistic;
CursorType:=ctKeyset;
CursorLocation:=clUseClient;
CacheSize:=100;
从表属性设置:
LockType:=ltBatchOptimistic;
CursorType:=ctKeyset;
CursorLocation:=clUseClient;
CacheSize:=100;
主表提交代码(都写成过程来调用的):
procedure THFZAdoDataSet.UpdateMasterRec;
begin //提交主数据集
Connection.BeginTrans;
try
UpdateBatch;
Connection.CommitTrans;
except
Connection.RollbackTrans;
Exception.Create('数据提交失败!');
end;
从表提交的代码:
procedure THFZAdoDataSet.UpdateSlaveRec;
begin //提交从表数据集
Connection.BeginTrans;
try
UpdateBatch(arAll);
Connection.CommitTrans;
except
Connection.RollbackTrans;
Exception.Create('数据提交失败!!');
end;
Refresh;
DataSource:=vDataSource;
end;
从表数据可以正常添加(是在断开主从关系的情况下),但就是不能提交到
后台,请大侠指点一下,问题在哪里,已经搞了好几个日日夜夜了,救救我吧
主表属性:LockType:=ltBatchOptimistic;
CursorType:=ctKeyset;
CursorLocation:=clUseClient;
CacheSize:=100;
从表属性设置:
LockType:=ltBatchOptimistic;
CursorType:=ctKeyset;
CursorLocation:=clUseClient;
CacheSize:=100;
主表提交代码(都写成过程来调用的):
procedure THFZAdoDataSet.UpdateMasterRec;
begin //提交主数据集
Connection.BeginTrans;
try
UpdateBatch;
Connection.CommitTrans;
except
Connection.RollbackTrans;
Exception.Create('数据提交失败!');
end;
从表提交的代码:
procedure THFZAdoDataSet.UpdateSlaveRec;
begin //提交从表数据集
Connection.BeginTrans;
try
UpdateBatch(arAll);
Connection.CommitTrans;
except
Connection.RollbackTrans;
Exception.Create('数据提交失败!!');
end;
Refresh;
DataSource:=vDataSource;
end;