Crystal Report and ADO question ...
-
Hi, I'm using VS .NET 2003 and CR 8.5 ... My project type is MFC Dialog-based program and i should display a ADO Recordset query result in viewer activex ... It's what i've done: 1- I made the Report with Crystal Report 8.5 and with connecting to .mdb database via OLEDB connection ... (it's ok) 2- Then i insert the Viewer Control in my project and also made the ado recordset object with a simple query like this: "select * from some_table where code=1" 3- i wrote below code:
m_RptApp.CreateInstance( "CrystalRuntime.Application" ); m_RptReportInfo = m_RptApp->OpenReport( _bstr_t(_T("rpt\\CompanyInfo_FA.rpt")) ); Line1: m_RptReportInfo->Database->SetDataSource( _variant_t( (IDispatch *)m_pRec, true ) ); m_ReportViewer.put_ReportSource( m_RptReportInfo ); m_ReportViewer.ViewReport();
I tried this code for Line1 too:m_RptReportInfo->Database->Tables->GetItem( 1 )->SetDataSource( _variant_t( (IDispatch *)m_pRec, true ) );
The Problem: the problem is the program shows ALL records ... and NOT the filtered recs !! 1- Can u tell me what's wrong with my code ?! 2- ( ADO Question ): say i have two _RecordsetPtr objects .. for example: _Rec1, _Rec2 .. _Recs1 fills by some records (by Open() mehod) Is there anyway to copy some records from _Rec1 to _Rec2 ?! for example i want to copy Record (pos) number 3, 10, 16 to _Rec2 ( sorry for my english .. ) Regards, Hadi -
Hi, I'm using VS .NET 2003 and CR 8.5 ... My project type is MFC Dialog-based program and i should display a ADO Recordset query result in viewer activex ... It's what i've done: 1- I made the Report with Crystal Report 8.5 and with connecting to .mdb database via OLEDB connection ... (it's ok) 2- Then i insert the Viewer Control in my project and also made the ado recordset object with a simple query like this: "select * from some_table where code=1" 3- i wrote below code:
m_RptApp.CreateInstance( "CrystalRuntime.Application" ); m_RptReportInfo = m_RptApp->OpenReport( _bstr_t(_T("rpt\\CompanyInfo_FA.rpt")) ); Line1: m_RptReportInfo->Database->SetDataSource( _variant_t( (IDispatch *)m_pRec, true ) ); m_ReportViewer.put_ReportSource( m_RptReportInfo ); m_ReportViewer.ViewReport();
I tried this code for Line1 too:m_RptReportInfo->Database->Tables->GetItem( 1 )->SetDataSource( _variant_t( (IDispatch *)m_pRec, true ) );
The Problem: the problem is the program shows ALL records ... and NOT the filtered recs !! 1- Can u tell me what's wrong with my code ?! 2- ( ADO Question ): say i have two _RecordsetPtr objects .. for example: _Rec1, _Rec2 .. _Recs1 fills by some records (by Open() mehod) Is there anyway to copy some records from _Rec1 to _Rec2 ?! for example i want to copy Record (pos) number 3, 10, 16 to _Rec2 ( sorry for my english .. ) Regards, HadiYEP !!! SOLVED ! :-D