我在报表服务中遇到了问题,无法在2005版本上运行本地rdlc文件。
我在HTML中设置了一个报表查看器来本地运行,如下所示:
<rsweb:ReportViewer ID="ReportingServicesReportViewer" runat="server" Height="100%"
ProcessingMode="Local" ShowParameterPrompts="False" Width="100%">
</rsweb:ReportViewer>
在代码中。// create SqlConnection
SqlConnection myConnection = new SqlConnection(ConnectionString);
myCommand.Connection = myConnection;
SqlDataAdapter da = new SqlDataAdapter(myCommand);
//get the data
DataSet data = new DataSet();
da.Fill(data);
if (data != null && data.Tables.Count > 0 && data.Tables[0].Rows.Count > 0)
{
ReportingServicesReportViewer.Visible = true;
ltrStatus.Text = string.Empty;
//provide local report information to viewer
ReportingServicesReportViewer.LocalReport.ReportPath = Server.MapPath(Report.RDLCPath);
//bind the report attributes and data to the reportviewer
ReportDataSource rds = new ReportDataSource("DataSet1", data.Tables[0]);
ReportingServicesReportViewer.LocalReport.DataSources.Clear();
ReportingServicesReportViewer.LocalReport.DataSources.Add(rds);
ReportingServicesReportViewer.LocalReport.Refresh();
}
else
{
ReportingServicesReportViewer.Visible = false;
ltrStatus.Text = "No data to display.";
}
当执行用于使用报表结果填充报表查看器的方法时,什么都没有出现,就好像报表查看器根本不存在一样。到目前为止,我已经采取了以下措施进行故障排除:
- 检查事件查看器以获取错误信息,而这是我得到的唯一相关信息:[Domain]\sp_dbadmin 原因:无法打开明确指定的数据库。然而,我连接的用户是 sysadmin。我已经检查了并确定了这一点,因为我检查了 sys.server_role_members。 - 我尝试模拟已登录用户的身份,但无济于事。 - 我创建了一个具有 sysadmin 权限的特定用户,并从 IIS 和 SQL Server 2008 上赋予了所有访问权限。
是否有人遇到过类似的问题,有什么想法?