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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...