Problem : Debug Assertion Failed: dbgdel.cpp Line: 52 _BLOCK_TYPE_IS_VALID

Problem : Debug Assertion Failed: dbgdel.cpp Line: 52 _BLOCK_TYPE_IS_VALID

The text in subject is that which is shown in a debug assertion error message box displayed when the m_pConn->Open(…) method below is called. When this line of code is executed, I am converting a CString variable (connectionString) to a _bstr_t. The full text of the error message is “Debug Assertion Failed! dbgdel.cpp Line: 52 _BLOCK_TYPE_IS_VALID”.  Can anyone shed light on this?  This code was previously working.  I must have changed something, but I don’t know what.  Please note, I am reading some entries for the ADO connection string from registry entries and populating these entries in my program as CString variables.

_bstr_t tablesNames;
_ConnectionPtr m_pConn;
m_pConn.CreateInstance (__uuidof(Connection));
CString connectionString;
if (usingAccess_1)
connectionString = “Provider=Microsoft.Jet.OLEDB.4.0; Data Source = ” + accessDBPath2;
else
connectionString = “Provider=SQLOLEDB;Data Source=” + mvwin32SQLsrvName + “,1433;Network Library=DBMSSOCN;Initial Catalog=” + mvwin32SQLsrvDB + “;” + “Trusted_Connection=Yes;”;

m_pConn->Open( _bstr_t( connectionString ), _bstr_t( “” ), _bstr_t( “” ), adConnectUnspecified );

-dotBomb


Solution : Debug Assertion Failed: dbgdel.cpp Line: 52  _BLOCK_TYPE_IS_VALID

Make sure that all components in your project are set to “Use Runtime Library: Multithreaded DLL”