In addition to
gellyfish's comments - it looks like you have more than one active $sth on the same connection, and this may be the cause of the problem. SQL Server (and Sybase) in general don't support multiple active statements on the same connection.
Michael