none
report will not display in reportviewer RRS feed

  • Question

  •  Hi everyone!

    I have put a reportviewer on a winform and chosen a report. I have then written the following code which should fill the report and display in the reportviewer, but it doesn't. Can somebody tell me what is missing.

     

    this.reportViewer1.Visible = true;

     

    DataSet thisDataSet = new DataSet();

     

    using (SqlConnection conn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Program Files\Microsoft Learning\2542\Unit04\Labfiles\Starter\CS\MosdotTuBeshvat\MosdotTuBeshvat\bin\Debug\Database1.mdf;Integrated Security=True;User Instance=True"))

    {

     

    using (SqlDataAdapter cmd = new SqlDataAdapter("ShowChildrenByInstitution", conn))

    {

    cmd.SelectCommand.CommandType =

    CommandType.StoredProcedure;

    cmd.SelectCommand.Parameters.Add(

    new SqlParameter("@ChildInstitution", SqlDbType.NVarChar));

    cmd.SelectCommand.Parameters[

    "@ChildInstitution"].Value = comboBox1.SelectedValue.ToString();

    cmd.Fill(thisDataSet,

    "Reports");

     

    ReportDataSource ds = new ReportDataSource("DataSetInstitution_ShowChildrenByInstitution", thisDataSet.Tables[0]);

     

    reportViewer1.LocalReport.DataSources.Clear();

    reportViewer1.LocalReport.DataSources.Add(ds);

    reportViewer1.LocalReport.Refresh();

    }

    • Edited by Moshe Y Sunday, May 17, 2009 3:07 PM
    Sunday, May 17, 2009 3:05 PM