Fix getting long strings

Handle null terminators got from SQLGetData with SQL_C_TCHAR
Also fix exception handling in some functions