Am having problem generating report in Windows Foems

Sep 2 2010 7:23 AM
Please am having problem generating report in windows form. When a run the application I would have the below error:

"An error ocurred during local report processing.
The report definition for report 'Fees.FeesReport.rdlc' has not been specified"

Please below is the code that I type in visual studio after designing the report and creating dataSet:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Reporting.WinForms;

using System.Data.SqlClient;

namespace Report
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

           
            string connectionString = "Data Source=EMMANUELNET-PC\\SQLEXPRESS;Initial Catalog=RoyalConnectivity;Integrated Security=True";
            SqlConnection con = new SqlConnection(connectionString);
            SqlCommand cmd = new SqlCommand();
            SqlDataReader reader;
            DataSet dsFees = new FeesDataSet();

            try
            {
                con.Open();

                cmd.CommandType = CommandType.Text;
                cmd.Connection = con;
                cmd.CommandText = "SELECT * FROM Fees";

                reader = cmd.ExecuteReader();
                dsFees.Tables[0].Load(reader);
                reader.Close();
                con.Close();

                reportViewer1.LocalReport.ReportEmbeddedResource = "Fees.FeesReport.rdlc";
                ReportDataSource rds = new ReportDataSource();
                rds.Name = "FeesDataSet_dtFees";
                rds.Value = "dsFees.Tables[0]";
                reportViewer1.LocalReport.DataSources.Add(rds);
               this.reportViewer1.RefreshReport();

            }

            catch (Exception ex)
          {
               MessageBox.Show(ex.Message);

              }

            finally
            {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
               
                }
           
            }

           
        }

       
    }
}


Answers (5)