I have the following code that binds rdlc to stored procedure. When I load the report page I get "loading" in loop.
protected void Page_Load(object sender, EventArgs e)
{
int id = Convert.ToInt32(id.Text);
ReportViewer1.ProcessingMode = ProcessingMode.Local;
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Reports/RepFullApp.rdlc");
DataSet ds = new DataSet();
ds = GetData(id);
if (ds.Tables[0].Rows.Count > 0)
{
ReportDataSource rds = new ReportDataSource("DatasetFullApp", ds.Tables[0]);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.LocalReport.Refresh();
}
}
private DataSet GetData(int id)
{
SqlConnection con = new SqlConnection("myConn");
con.Open();
SqlCommand cmd = new SqlCommand("sp1", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@ID", SqlDbType.Int).Value = id;
using (con)
{
using (SqlDataAdapter da = new SqlDataAdapter())
{
cmd.Connection = con;
da.SelectCommand = cmd;
DataSet ds = new DataSet();
da.Fill(ds);
return (ds);
}
}
}
Any kind of help will be appreciated.
Thank you in advance.