i am trying to initialise vaiables for use thoughout the app once a user has logged in. i have this but it's not working and i dont really know where im going wrong.
Code:
'-- Get the current User which will return the email address. dim cu as c = Context.Security.CurrentUser 'a5ws_getcurrentuser() 'Open SQL DB and retrieve values for the logged in user dim cn as sql::connection connection = "::name::MM3" if cn.open(connection) then dim args as sql::Arguments dim rs as sql::ResultSet dim session.contactname as c dim session.employeecompany as c dim session.contactfileloc as c dim session.contactemail as C dim session.contactid as c dim session.employeerole as c dim session.contacttype as C args.add("currentuser",cu) dim sqluser as c = "SELECT email, firstname, surname, file_location, contactid, employeerole, contacttype, organisation FROM contacts WHERE email = :currentuser " if cn.Execute(sqluser,args) then rs = cn.ResultSet if rs.DataIsNull(1) = .f. then '--Test if the rs has any data session.contactname = alltrim("firstname") + " " + alltrim("surname") session.employeecompany = "organisation" session.contactfileloc = "file_location" session.contactemail = "Email" session.contactid = convert_type(rs.data("contactid"),"C") session.employeerole = "Employeerole" session.contacttype = "ContactType" else '-- for debugging show a message here if the rs did not have any data end if end if end if
Comment