Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CString exception error in a DLL

Posted on 2001-07-01
5
Medium Priority
?
499 Views
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:
Filename=FOpen.GetFileName();

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  
{
private:
     
protected:
     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=FOpen.GetFileName();


     Filename = Filename.Left(13);
     ConPath=ConPath+Filename+";UID=sysadmin";    
         
0
Comment
Question by:dooley090698
  • 3
5 Comments
 
LVL 9

Accepted Solution

by:
Pacman earned 400 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 ?
0
 
LVL 2

Expert Comment

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

Author Comment

by:dooley090698
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.
Hmmmm....
0
 

Author Comment

by:dooley090698
ID: 6244906
Oh and this is the debug version btw
0
 

Author Comment

by:dooley090698
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!!  :)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

971 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