Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Crystal Report and ADO question ...

Crystal Report and ADO question ...

Scheduled Pinned Locked Moved C / C++ / MFC
databasequestioncsharpc++visual-studio
2 Posts 1 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hadi Rezaee
    wrote on last edited by
    #1

    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

    H 1 Reply Last reply
    0
    • H Hadi Rezaee

      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

      H Offline
      H Offline
      Hadi Rezaee
      wrote on last edited by
      #2

      YEP !!! SOLVED ! :-D

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups