I have a problem. The program works for 2 days or so, and then it starts the get errors at SQLDriverConnect. When I restart the program, it is fixed and the program can run for about 1 day, and then it gets the same problem again. Then if restart again, it takes half a day to get the error again.

I use SQL Server 2008 Express Edition.

The error code is

(DM) The driver listed in the data source specification in the system information or specified by the DRIVER keyword was not found or could not be loaded for some other reason.

at SQLDriverConnectA

any ideas what it could be? Might it be a memory leak? Not properly freeing handles? I use the following code to free my ODBC handles:

void closeConnection( SQLHENV henv, SQLHDBC hdbc, SQLHTSTMT hstmt )
     SQLFreeStmt( hstmt, SQL_CLOSE );
     SQLFreeHandle( SQL_HANDLE_STMT, hstmt );
     SQLDisconnect( hdbc );
     SQLFreeHandle( SQL_HANDLE_DBC, hdbc );
     SQLFreeHandle( SQL_HANDLE_ENV, henv );
Please advise, thanks in advance

Additional information:
I've been debugging the problem, and it seems not to be a memory leak problem, it always successfully frees the handles.

However, I noticed SQLDriverConnectA always returns SQL_SUCCESS_WITH_INFO and the error code is IM006:
(DM) During SQLDriverConnect, the Driver Manager called the driver's SQLSetConnectAttr function and the driver returned an error.

My connection string:
Driver={SQL Server Native Client 10.0}; Server=compname\\SQLExpress; Database=dbname; Uid=idname; Pwd=mypw;

I've also tried Driver={SQL Server} , but that does not fix the problem.