Aug 12, 2019 01:55 AM|samwu|LINK
Since I don't know your code, I can only give you an example.
such as this Report viewer control demo:https://www.aspsnippets.com/Articles/ASPNet-Report-Viewer-control-Tutorial-with-example.aspx
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Width="600">
protected void Page_Load(object sender, EventArgs e)
ReportViewer1.ProcessingMode = ProcessingMode.Local;
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report.rdlc");
Customers dsCustomers = GetData("select top 20 * from customers");
ReportDataSource datasource = new ReportDataSource("Customers", dsCustomers.Tables);
private Customers GetData(string query)
string conString = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
SqlCommand cmd = new SqlCommand(query);
using (SqlConnection con = new SqlConnection(conString))
using (SqlDataAdapter sda = new SqlDataAdapter())
cmd.Connection = con;
sda.SelectCommand = cmd;
using (Customers dsCustomers = new Customers())
The connection string tells you which database to connect to, and the query command tells you which table(or stored procedure) in the database to query.
If you haven't solved the problem, please post all your code.