As far as i understand In a thread webapps can loose their sessioncontext, especially when thread.sleep is used.
WebSessionContext lost error is shown in the messages pane during debugging.
If this problem occurs, the recordset will be nil because there is no session available for returning to.
[quote=68291:@Tom Russell]If I have a thread and place some code in the run method like this:
Dim myrec As RecordSet
myrec = Session.db.SQLSelect("SELECT * FROM SOMETABLE")
I get a NilObjectException when it hits that line and no idea why.
Any ideas or is this the wrong way to do it?
Thanks.[/quote]
Session is probably nil
The thread probably needs it own connection to the database
Sharing connections across threads is bound to eventually cause you problems
Subclass thread, add a property to it (myDBConnection)
Then when you create the thread create & assign a NEW db connection to it and yer off