Jump to content
  • Advertisement
Sign in to follow this  
da_cobra

strange errors

This topic is 4804 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I get the following error (trying to translate it from dutch to english) : "The instruction at 0x5f4794b6 points to the memory at 0xcdcdcee1. De read or write ("read") on the memory failed." I get the error in the following member function of my class :
HRESULT CAdoDatabase::InitDatabase()
{
	::CoInitialize(NULL) ;

	m_strConnection = _T("Provider=Microsoft.Jet.OLEDB.4.0;Data Source = ..//personen.mdb") ;
	m_strCmdText = _T("select * from personen") ;
	m_pRS = NULL ;
	m_piAdoRecordBinding = NULL ;
	
	m_pRS.CreateInstance(__uuidof(Recordset)) ;
	
	try
	{
		m_pRS->Open((LPCTSTR)m_strCmdText,
					(LPCTSTR)m_strConnection,
					adOpenKeyset,
					adLockOptimistic,
					adCmdUnknown) ;
	}
	catch(_com_error &e)
	{
		AfxMessageBox(e.Description()) ;
	}

	if (SUCCEEDED(m_pRS->QueryInterface(__uuidof(IADORecordBinding), (LPVOID*) &m_piAdoRecordBinding)))
	{
		m_piAdoRecordBinding->BindToRecordset(&m_rsADORecSet) ;
		return S_OK ;
	}
	else
	{
		MessageBox(NULL, "Fout bij het aanspreken van de database!", "Fout!", MB_OK) ;
		return S_FALSE ;
	}
	
	return S_OK ;
}


If I try to trace the error and I comment stuff out, then from the moment that I pass something to those pointers or strings (@ the top of the code) I get that error. I already did a "rebuild all", by the way (using VC6.0) Hope some1 can help me! TIA [Edited by - da_cobra on May 25, 2005 8:15:46 AM]

Share this post


Link to post
Share on other sites
Advertisement
A value of 0xcdcdcdcd indicates an uninitialized value in Visual Studio. Apparently, you have a pointer that was initialized from such a value, and you are referencing a location offset 20 bytes from the value of the pointer.

Share this post


Link to post
Share on other sites
uhm?!? :(

so what do you think I'm doing wrong?
All the member variables in that function are set as private members in my class.

Share this post


Link to post
Share on other sites
thx for the reply, but I don't think the error lies there, because if I run the following code, I still get that error :


HRESULT CAdoDatabase::InitDatabase()
{
m_strConnection = _T("Provider=Microsoft.Jet.OLEDB.4.0;Data Source = ..//personen.mdb") ;
m_strCmdText = _T("select * from personen") ;
m_pRS = NULL ;
m_piAdoRecordBinding = NULL ;



return S_OK ;
}


Share this post


Link to post
Share on other sites
can you tell us what data types those values are? I'm assuming the m_p variables are CComPtrs? What are the m_str variables? _bstr_t ?

That would really help, because you may be assigning the wrong character type into those strings?

[EDIT]
Also if those m_str are BSTR you should use ::SysAllocString and ::SysFreeString
[/EDIT]

Share this post


Link to post
Share on other sites
sure :


class CAdoDatabase
{
public :
CAdoDatabase() ;
virtual ~CAdoDatabase() ;

private :
CADORecSet m_rsADORecSet ;
CADORecSet *m_prsADORecSet ;
_RecordsetPtr m_pRS ;
IADORecordBinding *m_piAdoRecordBinding ;

CString m_strConnection ;
CString m_strCmdText ;
} ;


Share this post


Link to post
Share on other sites
Quote:
Original post by da_cobra
thx for the reply, but I don't think the error lies there, because if I run the following code, I still get that error :

*** Source Snippet Removed ***


Do you call the function like this?

foo->InitDatabase();

My bet is that the value of foo is 0xcdcdcdcd.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!