问题
How can one bind Crystal Reports to Entity Framework Entities?
I did find no workaround yet.
(And I have not enough points yet to vote on existing questions)
回答1:
As for me, I read below link
http://aspalliance.com/2049_Use_LINQ_to_Retrieve_Data_for_Your_Crystal_Reports.2
It tell me how to link EntityFramework and Crystal Report.
As for code behind ....
protected void Page_Load(object sender, EventArgs e)
{
Report.CrystalReport1 _Rpt = new Report.CrystalReport1();
List<Test> list_Test = new List<Test>();
using (tempdbEntities _tempdbEntities = new tempdbEntities()) {
list_Test = _tempdbEntities.Tests.ToList();
}
_Rpt.SetDataSource(list_Test);
CrystalReportViewer1.ReportSource = _Rpt;
CrystalReportViewer1.RefreshReport();
}
回答2:
Create the Crystal Report
You can now create the report using the XSD file.
Right click on the project and select AddàNew Item…
Select "Reporting" from the list of Visual C# templates and select the Crystal Reports template.
Change the name of the file to UserAccountReport.rpt and click the Add button.
The Crystal Reports Gallery dialog will appear. Select "As a Blank Report" and click the OK button.
In the Field Explorer window, right click on the Database Fields node and select "Database Expert…" from the pop-up menu.
The Database Expert dialog should appear.
Click the plus sign next to "Create New Connection"
Click the plus sign next to "ADO.NET (XML)"
The ADO.NET (XML) dialog should appear. Click on the button with three dots to browse to the UserAccountSchema.xsd file you created in the step above.
Click the Finish button.
You should see the UserAccountSchema under the ADO.NET (XML) node. Click on this node and then click the ">" button to move this to the Selected Tables list.
回答3:
Not sure about your question.
I know this doesn't help you right now (sorry)...
But just thought you might find it interesting that one of the long term goals of the EF and the Sql Reporting Services teams is to allow customers to use Reporting Services against an Entity Framework model (or EDM).
来源:https://stackoverflow.com/questions/824591/howto-bind-crystal-reports-to-entity-framework