报表查看器控件(WinForm)不显示数据,只显示表格。
但是,如果我使用ReportViewer 2.0执行RDL文件,它可以很好地显示所有数据。
它使用用户DSN ODBC引用。
private void reportViewer1_Load(object sender, EventArgs e)
{
reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local;
reportViewer1.LocalReport.ReportPath = "dlm1.rdl";
var rds = new ReportDataSource();
rds.Name = "DataSet1";
rds.Value = "DataSource1";
reportViewer1.LocalReport.DataSources.Add(rds);
reportViewer1.LocalReport.Refresh();
}
RDL的一部分
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition">
<DataSources>
<DataSource Name="DataSource1">
<ConnectionProperties>
<DataProvider>ODBC</DataProvider>
<ConnectString>Dsn=DLM User</ConnectString>
<IntegratedSecurity>true</IntegratedSecurity>
</ConnectionProperties>
<rd:DataSourceID>a900984d-8acf-416a-8130-8cc5086e1c03</rd:DataSourceID>
<rd:SecurityType>Windows</rd:SecurityType>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="DataSet1">
<Fields>
<Field Name="id">
<DataField>id</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="expectedStartTime">
<DataField>expected
有任何线索吗?