Jump to content

How can i access UniSession in UniMainModule?


A_MU

Recommended Posts

I need to write Log when UniMainModule Destory,so i write some code:

 

procedure TUniMainModule.UniGUIMainModuleDestroy(Sender: TObject);

begin

with uniMainModule.OraQry_common do

begin

close;

sql.Clear;

sql.Add('update aks_ldap_log set logouttime='+#39+MyDayToStr(now)+#39+' where staff_id='+get_id_str(uniMainModule.UserInfo.User)+

' and Session_ID='+#39+UniApplication.UniSession.SessionID+#39);

uniMainModule.OraSession_master.StartTransaction;

try

execsql;

uniMainModule.OraSession_master.commit;

except on e:exception do

begin

uniMainModule.OraSession_master.Rollback;

showmessage('Write Log Fail'+#13#10+e.Message);

end;

end;

end;

 

if DBConn_State then OraSession_Master.Close;

 

end;

 

But Compile fail,[DCC Error] MainModule.pas(208): E2003 Undeclared identifier: 'UniSession'

 

Of cause,i write code

........................

var

DBConn_State:boolean;

 

implementation

 

{$R *.dfm}

 

uses

UniGUIVars, ServerModule, uniGUIApplication;

..........................

HOW CAN I DO?

Link to comment
Share on other sites

  • 5 months later...
  • 10 years later...
On 7/4/2012 at 8:04 AM, asapltda said:

 

hello, I could write that he found the right solution?

i've done a Type Cast like

procedure TUniMainModule.OnMainModuleCreate(Sender: TObject);
begin
	...
	TUniGUIApplication(UniApplication).UniSession
	...
end;

and it worked for me.

Bye

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...