Hi all,
I face a problem which when i run my program and click on display button,
then windows pop up "unable to open database"?
did my coding below got problem?
Quote:
void CDisplay_Crystal_RPTDlg::OnDisplay()
{
// TODO: Add your control notification handler code here
// by default the ID of the CCrystalCtrl is IDC_CRYSTALREPORT1
UpdateData(TRUE);
// by default the ID of the CCrystalCtrl is IDC_CRYSTALREPORT1
CCrystalCtrl *m_cryscontrol =
( CCrystalCtrl*)( GetDlgItem(IDC_CRYSTALREPORT1));
CString str;
str = "{Table1.ID} = 1";
// where Table1 and Name is a name and a field
//in your Database, m_StudentName is a member variable of an edit box.
m_cryscontrol->SetReportFileName("C:\\Documents and Settings\\Owner\\My Documents\\Bryan\\C++code\\Display_Crystal_RPT\\Re port1.rpt");
m_cryscontrol->SetSelectionFormula(str);
m_cryscontrol->SetDiscardSavedData(TRUE);
m_cryscontrol ->SetAction(TRUE);
UpdateData(FALSE);
}
|