Home All Groups Group Topic Archive Search About

[Help] How to modify DataSource of CrystalReport at runtime?

Author
4 May 2006 4:57 AM
Jati Indrayanto
Hello everyone,

I am using .NET 2.0 (WinForms - C#) for building my project. I faced a
problem while I tried to change datasource of CrystalReport.

These are my program snippets

      CrystalReport1 obj = new CrystalReport1();

      obj.SetDatabaseLogon("cipto", "cipto");
      obj.SetDataSource(objEngine.manipulateData("SQL" ); //--> SQL =
select statemtens
      obj.SetDataSource(dataSet1.Tables["result"]);
//objEngine= my engine to results

             //dataset. i'm sure it works.
      crystalReportViewer1.ReportSource = obj ;


      In my crystal report i select all data , then in SQL statement
(at runtime) I changed the select
      statement with some criteria, it wont run, in my case the result
displayed 'freak' data. :(

      What's wrong with the code?
      Thank you,
      My Regards, Jati Indrayanto

AddThis Social Bookmark Button