Solved

Debug Assertion Failed: dbgdel.cpp Line: 52  _BLOCK_TYPE_IS_VALID

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now