Program create xsd for Crystal Report and provide all data on repo

Discussion in 'ASP .Net' started by JB, Apr 6, 2010.

  1. JB

    JB Guest

    Hello Community

    I am using C# and ASP.net .Net Framework 3.5 and an embedded
    Crystal Report in the web application will be created from a Dataset.xsd
    file
    that I create programmatically on the fly .

    When creating the Crystal Report rpt file using the "Database Expert" ,
    under "Create New Connection, Database Files" it shows "NewDataSet" and
    under it the default name "Table" after the appl creates the dataset.

    Next I use the carat to move the table named "Table" over to the
    "Selected Tables" pane and click "OK".

    I can see the fields in the table within the Dataset so I move
    the fields into the Details pane of Crystal Report .

    After that I make sure I can see the xml file that is created on
    the c: drive.

    Now I save the file and run the application.

    The problem is that only the first 2 rows from the Dataset/xml
    file show up on the report.

    The following is code for how the dataset and report is created:

    Dataset:

    myDataset = CreateDataset();
    MyDataset.WriteXml(@"c:\myData.xml");


    Report:

    ReportDocument psReport = new ReportDocument();
    string reportPath = Server.MapPath("myData.rpt");
    psReport.Load(reportPath);
    objReport.ReportLogin(psReport); Note: this line provides credentials

    CrystalReportViewer1.ReportSource = psReport;
    CrystalReportViewer1.DataBind();

    Am I connecting the rpt file and Dataset correctly?
    What can I do to make this report show all rows?
    Do I have to delete the xml everytime the DataSet is created?

    Thanks
    Jeff

    --
    JB
    JB, Apr 6, 2010
    #1
    1. Advertising

  2. JB

    Andy O'Neill Guest


    >"JB" <> wrote in message
    >news:...


    This code substitutes a datatable for the crystal report's datasource.
    If you must have a dataset then DataTable dt = myDataset.Tables[0];

    ReportDocument rd;
    // Tricky bit here is to make the name of the datatable match what
    the report expects
    dt.TableName = "DataTable1";
    rd = new ReportDocument();
    rd.Load(Server.MapPath("Reports\\myReport.rpt"));
    rd.SetDataSource(dt);

    rd.Refresh();
    CrystalReportViewer1.ReportSource = rd;
    CrystalReportViewer1.RefreshReport();
    Andy O'Neill, Apr 7, 2010
    #2
    1. Advertising

  3. JB

    JB Guest

    Re: Program create xsd for Crystal Report and provide all data on

    Hello Andy

    It works! Crystal Reports is reading the whole file. I had to make the
    xml file the datasource.

    Thanks
    Jeff
    --
    JB


    "Andy O'Neill" wrote:

    >
    > >"JB" <> wrote in message
    > >news:...

    >
    > This code substitutes a datatable for the crystal report's datasource.
    > If you must have a dataset then DataTable dt = myDataset.Tables[0];
    >
    > ReportDocument rd;
    > // Tricky bit here is to make the name of the datatable match what
    > the report expects
    > dt.TableName = "DataTable1";
    > rd = new ReportDocument();
    > rd.Load(Server.MapPath("Reports\\myReport.rpt"));
    > rd.SetDataSource(dt);
    >
    > rd.Refresh();
    > CrystalReportViewer1.ReportSource = rd;
    > CrystalReportViewer1.RefreshReport();
    >
    > .
    >
    JB, Apr 8, 2010
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Troll
    Replies:
    35
    Views:
    2,325
    Troll
    Sep 4, 2003
  2. =?Utf-8?B?RXJpYw==?=
    Replies:
    3
    Views:
    5,499
    Eliyahu Goldin
    Jan 21, 2005
  3. Learner
    Replies:
    1
    Views:
    1,087
    Richard Dudley
    Jan 11, 2006
  4. =?Utf-8?B?QmVu?=

    Crystal Report - No data on report

    =?Utf-8?B?QmVu?=, Apr 5, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    2,180
    =?Utf-8?B?QmVu?=
    Apr 5, 2006
  5. Comfort
    Replies:
    0
    Views:
    536
    Comfort
    Oct 18, 2004
Loading...

Share This Page