分太少
给你两个看看吧, 一般也就用到这两个
function TSysAppLogTrxUpdObj.WriteSysAppLog(SID: OleVariant;
LogType: SYSINT; const LogResource, LogClass, EventID, UserName,
ComputerName: WideString; var Data: OleVariant; MaxErrors: Integer;
var ErrorCount: Integer): OleVariant;
var
TrxDM: ISysAppLogTrxDM;
OwnerData: OleVariant;
Server: string;
Options: TGetRecordOptions;
RecsOut: Integer;
Params: OleVariant;
TmpClt:TClientDataSet;
begin
if Not CheckSID(SID) then Exit;
Options := [grMetaData, grReset];
Server := reg.GetProviderServer;
TmpClt:=TClientDataSet.Create(nil);
TmpClt.Close;
try
if Server = '' then
TrxDM := CoSysAppLogTrxDM.Create
else
TrxDM := CoSysAppLogTrxDM.CreateRemote(Server);
TmpClt.Data :=TrxDM.AS_GetRecords('dspSysAppLog', -1, RecsOut, Byte(Options), '', Params, OwnerData);
TmpClt.Append;
TmpClt.FieldByName('LogType').AsInteger:=LogType;
TmpClt.FieldByName('LogResource').AsString:= LogResource;
TmpClt.FieldByName('LogClass').AsString :=LogClass;
TmpClt.FieldByName('EventID').AsString :=EventID;
TmpClt.FieldByName('UserName').AsString:= UserName;
TmpClt.FieldByName('ComputerName').AsString:=ComputerName;
TmpClt.Post;
Result := TrxDM.AS_ApplyUpdates('dspSysAppLog', TmpClt.Delta, MaxErrors, ErrorCount, OwnerData);
SetComplete;
Result := True;
TmpClt.Free;
except
SetAbort;
TmpClt.Free;
raise;
end;
end;
function TSysAppLogTrxUpdObj.SetSysAppLog(SID: OleVariant;
var Data: OleVariant; MaxErrors: Integer;
var ErrorCount: Integer): OleVariant;
var
TrxDM: ISysAppLogTrxDM;
OwnerData: OleVariant;
Server: string;
Options: TGetRecordOptions;
begin
if Not CheckSID(SID) then Exit;
Options := [grMetaData, grReset];
Server := reg.GetProviderServer;
try
if Server = '' then
TrxDM := CoSysAppLogTrxDM.Create
else
TrxDM := CoSysAppLogTrxDM.CreateRemote(Server);
Result := TrxDM.AS_ApplyUpdates('dspSysAppLog', Data, MaxErrors, ErrorCount, OwnerData);
SetComplete;
Result := True;
except
SetAbort;
raise;
end;
end;