Trouble with session property

  1. 2 weeks ago

    Dean D

    Sep 4 Pre-Release Testers, Xojo Pro Santa Ynez California

    I would like to store some information in a property I added to a session so I can use it on different web pages the user might access. The property is the primary key for the facility the user chose when he logged in. I wrote this which executes without error,

    session.FacKey = rs.Field("FacKey").StringValue

    but the debugger reveals that there is nothing in the session.FacKey property. Trying to use the property in an SQL statement also fails with no value returned for session.FacKey. FacKey was created in the IDE as a public string property of the session (string because its primary use will be in SQL statements). My database is also a property of the session and works as expected.

  2. Olivier C

    Sep 5 Pre-Release Testers, Xojo Pro Europe (Belgium, France)

    Maybe you could provide more details:

    • where is your code executed, session event ? (remember, using session within the session object context is bad practice and you should use self.FacKey)
    • did you debug this line and what’s the rs like ?
    • how/where do you open your SQL db and how/where do you get the recordset ?
  3. Dean D

    Sep 5 Pre-Release Testers, Xojo Pro Santa Ynez California

    The code is executed in the login window using the recordset returned after the user enters a valid email address and password. The correct facility value is returned in the recordset. The CubeSQL database connection is made in the session.Open. There is also a database connection made in the app.Open for HandleSpecialURL events.

    I have been passing values from page to page and thought using a session property would be more efficient, but I haven't been able to get it to work.

  4. last week

    Dean D

    Sep 5 Pre-Release Testers, Xojo Pro Santa Ynez California

    Apparently, this problem is caused by multiple sessions being active in my browser. I just put a breakpoint in a routine that works with session.FacKey in the SQL statement. I have a CurrentSessions= session statement in the session.open event and when I look at it in the debugger at the breakpoint, it shows nothing for the FacKey value while the statement variable shows the value as it should. I have seen breakpoints set in session.open and session.shown fire multiple times when I only expected it once. Never worried about it before as the program worked, Now I need to look into what is happening more.

or Sign Up to reply!