dynamic crystal report in c#

  • Thread starter ireallyneedtoknow2007
  • Start date
I

ireallyneedtoknow2007

hello, I am using c#, VS2005. I need to create a crystal report that
will be created on the fly
and I will need parameters. I have reports already running in VS2003
but can't get simplified versions of them to work in 2005. In 2003 a
class file was created when I designed the report. I then created a
reference to the class and then added the data source as
cr.SetDataSource(ds.Tables[0]). no class is created in 2005, so do I
need to use cr.Load?, but I have no .rpt file. How do I create a rpt
file if needed? I do have the report designed in the project. How
do I reference the report I designed? also, I only have the Crystal
that shipped with 2005 (no full versions). I have tried several
variations of the code below with no success. thanks for any
assistance

ReportDocument cr = new ReportDocument();
string connection="Data Source=src;User ID=id;Password=pass;";

// virtual directory
string reportpath=@"\\server\reports\";

//??????
string reportname = Server.MapPath("xxx.rpt");

CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt=new
ReportDocument();
string sql = "select employee from mytable";
DataSet ds=new DataSet();
OracleConnection oOracleConn = new OracleConnection(connection);
oOracleConn.Open();
OracleCommand cmd = oOracleConn.CreateCommand();
cmd.CommandText = sql;
cmd.CommandType = CommandType.Text;
OracleDataAdapter adapt = new OracleDataAdapter(cmd);
adapt.Fill(ds);
oOracleConn.Close();

??????????
// what do i load here, i have no rpt file
cr.Load(reportname);

cr.SetDataSource(ds.Tables[0]);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top