Recently, we used crystal report for reporting. We did a small test in vs.net. We added a crystal report control to the page and specified an RPT path, which can be loaded normally in design, however, when view in browser, the following error occurs:
Note:An error occurs during compilation of resources required to provide services to this request. Check the following error details and modify them as appropriate. Source code.
Compiler error message:Cs1026: should be input)
Row 14: <CR: crystalreportviewer id = "crystalreportviewer1" style = "Z-INDEX: 101; left: 8px; position: absolute; top: 8px "runat =" server "width =" 875px "Height =" 1163px "reportsource =" <% # D: \ wwwroot \ report \ report1.rpt %> ">
The error message is 14 rows.
If reportsource is not added to the control, no such error message is displayed. Therefore, the reportsource is written in page_load, And the view in browser is displayed normally.
CodeAs follows:
Private void page_load (Object sender, system. eventargs E)
{
// Put user code to initialize the page here
Crystalreportviewer1.reportsource = ("D: \ wwwroot \ report \ report1.rpt ");
}