HowTo: Convert a module to DBTNG

DBTNG is the new database abstraction layer of Drupal 7. It uses several OOP principles and provides far more features than Drupal 6 did.

Most queries need to be slighty changed to work with DBTNG, this blog post will explain some of the most common conversions.
Please follow the below link
http://blog.worldempire.ch/story/howto-convert-module-dbtng