A. If you are using a utility then this is normally under file/options or tool/options from the menu. Set it to the value you require - 0 means infinite (no) timeout.

For example :-

Enterprise Manager time-out is set in TOOLS/OPTIONS/Connection/Query Timeout
Query Analyzer time-out is set in QUERY/Current Connect Options/Query Timeout

If you want to do it in C/VB code then this depends on the data access method. Look in the BOL for more details, but with raw ODBC you would use :-

etcode = SQLSetConnectAttr(m_hdbc, SQL_ATTR_CONNECTION_TIMEOUT,