Solved

Debug Assertion Failed: dbgdel.cpp Line: 52  _BLOCK_TYPE_IS_VALID

Posted on 2004-04-22
2
3,365 Views
Last Modified: 2013-11-20
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
0
Comment
Question by:dotBomb
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 125 total points
ID: 10889064
Make sure that all components in your project are set to "Use Runtime Library: Multithreaded DLL".
0
 

Author Comment

by:dotBomb
ID: 10889597
jkr,

You are exactly correct, and in fact, I remember changing this, erroneously I see.
To summarize, in my MFC project properties in the .NET IDE, under "Code Generation" the "Runtime Library" should be set to "Multi-threaded Debug DLL (/MDd)" in Debug mode and "Multi-threaded DLL (/MD)" in Release mode.  I sure hope this helps someone.  It helped me immensely!

-dotBomb
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question