简体   繁体   English

无法使用报表查看器 Visual Studio 2008 加载报表

[英]Cannot load Report using Report Viewer Visual Studio 2008

I am using VS 2008 and SQL 2008,.I am trying to build a report using Report viewer using Parameters.I am completly new to this concept,so i was trying to develop using the basic steps as shown in various tutrials.我正在使用 VS 2008 和 SQL 2008,我正在尝试使用使用参数的报告查看器构建报告。我对这个概念完全陌生,所以我试图使用各种教程中所示的基本步骤进行开发。

1> connect to dataset 1> 连接到数据集

2- Configure server 2- 配置服务器

3 - table Adapter 3-表适配器

4 - Add new report 4 - 添加新报告

5 - Drag a table in the Report screen and add the columns 5 - 在报告屏幕中拖动表格并添加列

6 * Here i am adding parameters ( fromdate,todate).Please tell me what mistake i am doing 6 * 我在这里添加参数(fromdate,todate)。请告诉我我在做什么错误

I got to Reports -> ReportParamaters -> Add new Parameter - > fromdate -> type: Datetime.我得到了报告 -> ReportParamaters -> 添加新参数 -> fromdate -> 类型:日期时间。 (Same for Todate) (今天也一样)

7 - > In the web page. 7 -> 在web页面。 Added 2 textboxes and a button添加了 2 个文本框和一个按钮

8 - > Dragged Reportviewer - > choose Datasoure and Report name 8 -> 拖入Reportviewer -> 选择Datasoure和Report name

Now the code Behind.现在代码在后面。

On button click单击按钮

Protected Sub btnView_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnView.Click
        Try
            setReportParameters()
            Me.ReportViewer1.LocalReport.Refresh()
        Catch ex As Exception

        End Try
    End Sub

 Private Sub setReportParameters()
        Dim Fromdate As New ReportParameter("Fromdate", tbFromDate.Text)
        Dim Todate As New ReportParameter("Todate", tbtodate.Text)

        Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter() {Fromdate, Todate})

    End Sub

When i Run the Report I get this Following Error当我运行报告时出现以下错误

"

An error occurred during local report processing.
    Error during processing of ‘FromDate’ report parameter.

All i can see is the textboxes and Button.When i click on it,nothing happens...我只能看到文本框和按钮。当我点击它时,没有任何反应......

Please help请帮忙

"

I see two things to check:我看到两件事要检查:

1.) You set the parameter "fromdate" with the parameter "Fromdate", I believe this is case sensitive. 1.) 您使用参数“Fromdate”设置参数“fromdate”,我相信这是区分大小写的。

2.) Fromdate in the report is a datetime, you are passing a string (tbFromDate.Text) Make sure this is a valid date. 2.) 报告中的 Fromdate 是一个日期时间,您正在传递一个字符串 (tbFromDate.Text) 确保这是一个有效的日期。

 Dim Fromdate As New ReportParameter("Fromdate", cDate(tbFromDate.Text))

A couple more things to check.还有几件事要检查。

  1. Verify that the parameter in the report is a DateTime data type.验证报表中的参数是否为 DateTime 数据类型。

  2. You might need to format the date as well.您可能还需要格式化日期。 I've used this in the past with success:我过去曾成功地使用过它:

    ReportParameter startAtParam = new ReportParameter("StartAt", startAt.ToString("MMM, dd yyyy"));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Visual Studio 2008中从Crystal Report Viewer删除边框/背景 - Removing border/background from Crystal Report Viewer in Visual Studio 2008 Visual Studio 2010报表查看器 - Visual Studio 2010 Report Viewer Visual Studio 中的报告查看器配置错误 - Report Viewer Configuration Error in Visual Studio 可以在Visual Studio 2008中使用Report Viewer 2010控件吗? - Can Report Viewer 2010 control be used in Visual studio 2008 without problems? 如何使用Visual Studio报表查看器将参数或值传递给报表服务报表 - How to pass a parameter or a value to reporting service report using visual studio report viewer Visual Studio 2015 - Report Viewer 2015可再发行 - 使报表查看器“12”正常工作 - Visual Studio 2015 - Report Viewer 2015 redistributable - Getting Report Viewer “12” working Visual Studio 2015中的报表查看器未在asp.net中的窗体上下降 - report viewer in visual studio 2015 is not drop on form in asp.net Visual Studio报表查看器无法连接到远程SSRS服务器 - Visual Studio Report Viewer does not connect to remote SSRS server 如何使用Visual Studio报表查看器显示报表服务报表 - how to use visual studio report viewer to show reporting service reports 如何在报表查看器中定义主体尺寸? (视觉工作室 2010) - How to define Body Size in Report Viewer ? (Visual studio 2010)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM