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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database Access via PropertySheet

Status
Not open for further replies.

fdsouth

Technical User
Jun 6, 2001
61
US
I've been working on this little project for weeks and I'm stuck.

I have created a dialog that has three tabbed property pages. Each one contains text boxes for entering different types of data for an employee. Each employee has a single database entry (1 row) that lists all the information found on the three pages. Everything compiles fine, but I get a run-time error when I try to execute it.

I originally compiled the code for a simple Doc/View based application and it worked fine. I didn't like the way it looked so I tried to use a property sheet based GUI for aesthetics.

Does anyone know if the DoDataExchange function for CPropertyPage class is any different than the CRecordView class? In both cases I use the following to exchange data between the database and the property page's edit boxes:

Code:
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
}

Thanks in advance
 
I had just write the same program code last week,and I also used tree Property pages to accept employee's information,and I succeed.

I could can you send me a little code,I think I can help you.
 
That would be GREAT. Email me whatever you want to dsouthard@mcritx.com.

Thanks again
 
LoveInSnowing,

Don't mean to pester you, but can I take a look at the code you offered.

Thanks
 
OK,I am trying write a little code for you,I think I will send you tomorrow.
 
Hi,
CRecordView uses RFX_ to update the recordsets,
which in ur code is missing,
You could simulate by using code like below

if( pDX->m_bSaveAndVaidate )
{
//Code to transfer to the Recordset
// and add a new record
}
else
{
//Simply move to the Next/Previous Record
// This could be based on a direction flag
// in this dialog, set in a button click
// which triggers this update.
if( m_bMoveForward )
MoveNext() ;
else
MovePrev() ;
//Transfer data from recordset to the dlg vars
// and show in the dialog
}
 
prem_gali,

I still don't know what I'm missing. I'm sure it's something obvious but I can't seem to figure it out. I have 2 classes in my app (that are significant to this). CEmployeeListSet (derived from CRecordset) and CPersonalData (derived from CPropertyPage). I use CEmployeeListSet to connect to the database. Within this class is the DoFieldExchange function which uses RFX_ to gather table data and place it into various CStrings. I then try to fill the property page's edit boxes as shown above. It seems so SIMPLE!!

Within CPersonalData's constructor is the line:

Code:
CEmployeeListSet *m_pSet;

When I use the DDX_ calls like the one above, shouldn't it get data from the database and populate the edit boxes?

Thanks for your help LoveInSnowing, but the example you sent me uses ADO/OLE. I've never used OLE connections before and that would only confuse me more trying to learn it now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top