1. Set the report. rdlc, link the database string, and generate the dataset file. It is in app_code.
2. Complete report. aspx, drag and drop the reportviewer control, automatically generate objectdatasource, and select report. rdlc report.
3. Place the link string in the web. config file.
<? Xml version = "1.0" encoding = "UTF-8"?>
<Configuration>
<AppSettings/>
<ConnectionStrings>
<Add name = "callmealConnectionString" connectionString = "Data Source =.; Initial Catalog = data; Persist Security Info = True; User ID = sa; Password = mima"
ProviderName = "System. Data. SqlClient"/>
</ConnectionStrings>
<System. web>
<HttpHandlers>
<Add path = "Reserved. reportViewerWebControl. axd "verb =" * "type =" Microsoft. reporting. webForms. httpHandler, Microsoft. reportViewer. webForms, Version = 8.0.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a"
Validate = "false"/>
</HttpHandlers>
<Compilation debug = "false">
<BuildProviders>
<Add extension = ". rdlc" type = "Microsoft. Reporting. RdlBuildProvider, Microsoft. ReportViewer. Common, Version = 8.0.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a"/>
</BuildProviders>
</Compilation>
<Authentication mode = "Forms"/>
</System. web>
</Configuration>
4. Copy an object
Microsoft. ReportViewer. Common. dll
Microsoft. ReportViewer. ProcessingObjectModel. dll
Microsoft. ReportViewer. WebForms. dll
Microsoft. ReportViewer. WinForms. dll
To the bin directory of the bin VM. Files can be copied from c: \ windows \ assembly using the doscommand.
In this way, Microsoft reports can be used on virtual hosts.
It seems that Microsoft reports are easier to use, and Crystal Reports are not easy to publish (or release, but it is more troublesome)
In the future, it will be better to use Microsoft's rdlc for projects.