Solved

Debug Assertion Failed: dbgdel.cpp Line: 52  _BLOCK_TYPE_IS_VALID

Posted on 2004-04-22
2
3,397 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Whole sheet autoscrub still needed 19 51
Best tools for Backup and restore of Wordpress site 6 57
substring method in java 1 129
Problem to App 4 97
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: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.

840 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