Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC Database Problem

Status
Not open for further replies.

fdsouth

Technical User
Jun 6, 2001
61
US

I've been trying to return data from an ODBC database and display it in a tabbed dialog (property page). The code compiles just fine, but I get a runtime error during execution. Specifically,

ERROR MESSAGE:
Code:
TRACE0("ASSERT_VALID fails with NULL pointer.\n");
		if (AfxAssertFailedLine(lpszFileName, nLine))
			AfxDebugBreak();
		return;     // quick escape

I know the CRecordset class I created works fine (I've used it before in a single dialog page). The problem seems to occur during data exchange in the CPropertypage class. Here's the code that is suspect:

CPROPERTYPAGE SOURCE:
Code:
CPersonalData::CPersonalData() : CPropertyPage(CPersonalData::IDD)
{
	//{{AFX_DATA_INIT(CPersonalData)
	m_pSet = NULL;
	//}}AFX_DATA_INIT
}

void CPersonalData::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPersonalData)
	DDX_FieldText(pDX, IDC_TITLE, m_pSet->m_TITLE, m_pSet);
	//}}AFX_DATA_MAP
}

CRecordset* CPersonalData::OnGetRecordset()
{
	return m_pSet;
}

In addition, m_pSet is defined in the header file for the CPropertypage as follows:

CPROPERTYPAGE HEADER:
Code:
class CPhysiciansListSet;

class CPersonalData : public CPropertyPage
{
	DECLARE_DYNCREATE(CPersonalData)

// Construction
public:
	CPersonalData();
	~CPersonalData();

	virtual BOOL PreTranslateMessage (MSG* pMsg);

// Dialog Data
	//{{AFX_DATA(CPersonalData)
	enum { IDD = IDD_PERSONALDATA };
	CPhysiciansListSet* m_pSet;
	//}}AFX_DATA
};

Any suggestions would be GREATLY appreciated. I've been screwing around with this app for a week now on this one problem and I'm about to go crazy.

Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top