Skip to Content
avatar image
Former Member

Crystal Report: Subreport without database require logon to server 'NewDataSet'

I use Crystal Reports 13 with C# Visual Studio 2017. I am trying to create a simple report with subreport. There is no connection to databse. There is tow business-object:

public class Master
    {
            public int Id { get; set; }
            public string Name { get; set; }
    }

    public class Detail
    {
            public int Id { get; set; }
            public int MasterId { get; set; }
            public string Name { get; set; }
    }

Main report binding to Matser business-object in Database expert. Subreport binding to Detail business-object. I try to send datasource to the report by this code:

var report = new MainReport();
    report.SetDataSource(new Collection<Master> { new Master { Id=1, Name="Master1"} });
    report.Subreports[0].SetDataSource(new Collection<Detail> { new Detail{ Id=1, Name="Detail1"}, new Detail{ Id=2, Name="Detail2"} });
    report.Refresh()
    CristalViewer1.ViewerCore.ReportSource = report;

After start application appears logon promt to 'NewDataSet' server. Separately bouth Main report and subreport work fine.

What's wrong?

Thanks!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer