Solved

CString exception error in a DLL

Posted on 2001-07-01
5
493 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 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 ?
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand data scrubbing tool 13 32
Named range not carried over 10 63
twoTwo  challenge 35 101
Modbus - whats the maximum I can store in one register? 4 79
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…
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

813 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

17 Experts available now in Live!

Get 1:1 Help Now