Added try-catch for converting SQL results to variable