Modifications in regard to David's comment and suggestion

Added a common project for DBhandler, used preparedstatment to avoid
Sql injection attack, and added some other minor changes.