Having trouble changing query parametr from URL value to session value
I'm trying to change the way a query works from using a URL parameter as the value to search a database against, to using a session variable value. I've changed this in the server behaviour and double-checked that the session variable value is valid by having it written to the web page. However, whenever I run the page using the session variable value I get a 500 internal server error.
I've attached 2 versions of the page in the zip file, one that uses the URL parameter value and works perfectly and one that uses the session variable value and results in the error.
I've been staring at the code for ages and cannot see what is causing this error. If anyone can help me it would be much appreciated.