Thanks for your help. I still have a small query, What do you generally prefer for connecting to Database, I use the CDatabase object to connect with the SQL server and I am just not able to avoid the deadlocks in both cases, that is single connection object or multiple connection objects. I seem to be getting this problem when a thread is executing a query and the SQL server goes down. Any suggestions? Thanks a lot, Mahadevan.