本文介绍了如何在报表查看器asp.net中显示我的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个带有报表查看器的网页,该报表查看器可以让我的数据显示在报表查看器中。以下是我在下面尝试过的内容。我没有收到任何错误,只是没有加载任何东西到观众。如何修复此问题以显示我的数据?



I have created a web page with with a report viewer that is suppose to get my data then show in the report viewer. Here is what I have tried below. I do not receive an error just not loading anything into the viewer. How can I fix this to display my data?

DataSet orderNumbers = new DataSet("OrderNumbers");
    SqlDataAdapter da = new SqlDataAdapter();
    SqlCommand cmd = new SqlCommand("SELECT WorkOrderNumber, LineNumber FROM WorkOrder WHERE WorkOrderNumber = " + workordernumberTextBox.Text);
    cmd.CommandType = CommandType.Text;
    cmd.Connection = new SqlConnection(ConfigurationManager.ConnectionStrings["LConnection"].ToString());
    da.SelectCommand = cmd;

    da.Fill(orderNumbers, "OrderNumbers");

    ReportViewer1.ProcessingMode = ProcessingMode.Local;
    ReportViewer1.LocalReport.DataSources.Clear();
    ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("OrderNumbers", orderNumbers.Tables[0]));
    ReportViewer1.LocalReport.Refresh();

推荐答案

这篇关于如何在报表查看器asp.net中显示我的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 22:32