ConnectTimeOut will solve your problem.
Check out the help of SqlSetProp
SqlSetProp(Handle,ConnectTimeOut,Value)
Specifies the time to wait (in seconds) before returning a connection time-out error. If you specify 0, the wait is indefinite and a time-out error is never returned. ConnectTimeOut can be 0 to 600. The default is 15.
Read/write.
>That will only work if the connection is established already will it not.
>
>How can you set a timeout on the actual time it takes to connect to the remote database? At the moment there is no timeout, so if the internet connection is slow, and no connection can be made to the database, the program just hangs up!