具体函数是这样的:
function TSysManagerDBAdapter.UpdateData(AType:String;AUpdateList:TObjectList):TStringList;
var sConn:TADOConnection;
// s:TStringList;
begin
AType:='update';
sConn:=dmSharer.GetConnByName('System');
roleDataSet:=TADODataSet.Create(nil);
roleDataSet.Connection:=sConn;
roleDataSet.UpdateBatch;
userDataSet:=TADODataSet.Create(nil);
userDataSet.Connection:=sConn;
userDataSet.UpdateBatch;
rightDataSet:=TADODataSet.Create(nil);
rightDataSet.Connection:=sConn;
rightDataSet.UpdateBatch;
urDataSet:=TADODataSet.Create(nil);
urDataSet.Connection:=sConn;
urDataSet.UpdateBatch;
moduleDataSet:=TADODataSet.Create(nil);
moduleDataSet.Connection:=sConn;
moduleDataSet.UpdateBatch;
AUpdateList.Insert(0,moduleDataSet);
AUpdateList.Insert(1,roleDataSet);
AUpdateList.Insert(2,userDataSet);
AUpdateList.Insert(3,urDataSet);
AUpdateList.Insert(4,rightDataSet);
if sConn<>nil then
begin
// s:=TStringList.Create;
try
sconn.BeginTrans;
moduleDataSet.ExecuteOptions;
urDataSet.ExecuteOptions;
rightDataSet.ExecuteOptions;
userDataSet.ExecuteOptions;
roleDataSet.ExecuteOptions;
sconn.CommitTrans;
except
end;
// s.Insert(0,' update');
// result:=s;
end;
moduleDataSet.Close;
moduleDataSet.Open;
urDataSet.Close;
urDataSet.Open;
rightDataSet.Close;
rightDataSet.Open;
userDataSet.Close;
userDataSet.Open;
roleDataSet.Close;
roleDataSet.Open;
end;
谁能告诉我怎样抛出异常呢?