MySQLPreparedStatement NilObjectException

dim ps as MySQLPreparedStatement ps = app.mDB.Prepare( "SELECT * FROM user WHERE email = ? " ) ps.BindType( 0, MySQLPreparedStatement.MySQL_TYPE_STRING ) rs = ps.SQLSelect( )

Getting error on above code — sometime ----- work most of the time.

The table has “email” field as ‘TEXT’, and ID is key field.

Have been running this in debug mode for several weeks without problem till today. Running it live (on line) starting yesterday and crashed a few times. This MAY have been the problem.

Any help would be appreciated.

which line? which variable is nil? ps? app.mDB? u?

That line.

Have you connected to the database?

Yes, Was connected, this was not the first use of these instruction. The was valid. The table had records.

I just notice the dim statement has ‘MySQLPreparedStatement’, where the doc. only show ‘PreparedStatement’.

What is Nil, App.mDB or ps?

Thanks Ell.

The database had been closed and was Nil.

The Session.Close routine has code to close and Nil theDB. I put a break in it and repeated the process to catch my error and had a hit.

Now the question is “What causes the Session Close event.”

Thanks again.

The Session.Close event fires when a user disconnects.

You really should be holding a separate database connection for each session as a property of Session instead of in a property of App.

Thanks Greg.

I read about that in the docs. on WebSession, so I have been going thru the docs about WebSession and WebApplication trying to figure where to put like property like ActiveUser (which is info on the current active user) and ActiveIssue (which is info on the current issue being updated/looked at.

The docs are not to clear on this; nether are the examples.

Both of them sound like session-specific data. App is for data shared between all users.

And I would look to the User’s Guide for guidance on this, not the Language Reference.

Thanks Tim.

I will look, again, did not see much.

Thanks Tim.
I have move the variables from App to Session as you suggests.
When testing/debugging and want to look at the variables in Session can not find “Session”.

Is there a way to view the Session’s variables in the Debugger?