Answered Don't want to see ODBC error popup

  • martedì 31 luglio 2012 11:40
     
     

    Hi,

    I'm using ODBC with SQL Server 2008.

    My programs connects frequently (using a timer) to a database and sometime i have an error popup window saying "Micrososft SQL Server Login     Connection failed SQLState: 'S1T00', SQL Server error: 0  [Microsoft][ODBC SQL Server driver]Timeout expired"

    My question is :

    is there away to prevent ODBC to show this popup window?

    If yes how can i do it ?

    Thanks.


    MME

Tutte le risposte

  • martedì 31 luglio 2012 14:32
     
     
    Use defensive programming in the first place. And then you should consider using exception handling.
  • martedì 31 luglio 2012 16:16
     
     

    Thanks for your answer.

    I've got something like that

    ===========================================

      TRY
      {

           CDaoDatabase::Open(NULL,FALSE,FALSE,"ODBC;DSN=BASESQLSERVER;UID=cts;PWD=cts"); //Connect to SQL 2K8 Xpress via ODBC
      }
      CATCH_ALL (e)
      {
       // if timeout reached or not a lock problem, give up
       if (zf_EndRetry(wcmnk_nDaoErr(e))) THROW_LAST();
       else continue;
      }
      END_CATCH_ALL

    ============================================

    Sometimes when i call CDaoDatabase::Open(...) the error popup window saying "Micrososft SQL Server Login     Connection failed SQLState: 'S1T00', SQL Server error: 0  [Microsoft][ODBC SQL Server driver]Timeout expired" appears and i want to know if there is a way to say to ODBC o SQL Server no to show this window.

    Thanks.


    MME

  • martedì 31 luglio 2012 16:22
     
     Con risposta

    I'm quite sure, that your THROW_LAST() is your problem..