Updated DBQuery method so it can be use dynamically.