Florence,
> When my application connect to the sql server (c/s), normally i retrieve the records out very fast but sometimes it hang and no response. What could have happened? Is it deadlock ?
You should go to the SQL management tool and find out what SQL command is taking so long, these tools can also tell you if there is a locking condition involved.
What are your SQLSetProps for the connection?
> Sometimes, the sql server already disconnected but i can not catch out this fast so my application take a very long time still haven't finish to run an transaction. How to prevent this and if i dun want to put try and catch at every records but i want an instance response to let me prompt out a proper message that my application has failed.
In general you should always check the return values of the SQL* functions. If the return value indicates an error condition, you need to call aerror() to get more detailed information. A lot of people write their own wrapper functions/methods so that they have consistent handling of SQL errors.