CString exception error in a DLL

Posted on 2001-07-01
Last Modified: 2013-11-20
I have a class in a DLL.
It is currently dynamicly linked to the MFC's.
This is a code snipet from the base class.
Everytime I try to run it I get an exception error at the line:
ConPath = "ODBC;DSN=Simply: ";
If I comment out this line the next exception error occurs at:

Seems to be the CString class (and yes I have included the header file for the CString class..:) )

Any suggestions would be appreciated..

class  CAccounts  
     long NoAccounts;
     long NoTxs;    
     CTime CurrentUsingDate;
     CString ConPath;
     CString Filename;

void CAccounts::OpendataBase()    
ConPath = "ODBC;DSN=Simply: ";
CFileDialog FOpen(TRUE,"*.sdb","*.sdb",OFN_HIDEREADONLY,"Simply Data |*.sdb ||");
     if (FOpen.DoModal()==IDOK)

     Filename = Filename.Left(13);
Question by:dooley090698
  • 3

Accepted Solution

Pacman earned 100 total points
ID: 6243883
I don't think that the problem is in the code you posted.
Maybe some memory overwriting in another part of your program ?

Expert Comment

ID: 6243898
Is this sutisfied:
You have to use only combinations Debug DLL with Debug App, and Release DLL with Release App.

Author Comment

ID: 6244904
Odd thing though is if I change the CString variables to char and use the string manipulation routines (ie strcpy , strlen etc.) all seems to works fine.

Author Comment

ID: 6244906
Oh and this is the debug version btw

Author Comment

ID: 6245312
well I found the problem...
Would you believe I had declared the class in the main exe but never created an instance of it.....DOH!!!!!
That seemed to clear things up.....
If I keep making STUPID STUPID mistakes like that figure I should maybe take up another hobby!!  :)

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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
Named range not carried over 10 65
ffmpeg - "rtsp://...... Operation not permitted" 4 86
Problem to open Excel file 15 178
Way to decrease size of apk file 9 87
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

830 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