Sandeep Kesari Ответов: 0

Невозможно запустить rptvwrclinicwsieapointmentcount.localreport.subreportprocessing += new subreportprocessingeventhandler(subreport_appointmentmonthcount); событие


При создании вложенного отчета через RDLC в C# asp.net в веб-приложении я обнаружил ошибку, связанную с

RptVwrClinicWsieApointmentCount.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(Subreport_AppointmentMonthCount);


Я попробовал следующий ниже упомянутый код... Пожалуйста, подскажите мне, что еще мне нужно, чтобы удалить следующую ошибку :-

Что я уже пробовал:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Globalization;
using System.IO;

using System.Configuration;
using System.Data.SqlClient;
using Microsoft.Reporting.WebForms;

namespace Theraplan
{
    public partial class ClinicWiseAppointmentCount : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                FillClinicList();
                //FillTherapistList(ddlClinicNames.SelectedValue.ToString());


            }
        }
        private void FillClinicList()
        {
            try
            {

                TCA_Appointment_DLL objDLL = new TCA_Appointment_DLL();
                DataTable dtClinic = null;

                dtClinic = objDLL.getClinicList();

                ddlClinicNames.DataSource = dtClinic;
                ddlClinicNames.DataValueField = "Clinic Id";
                ddlClinicNames.DataTextField = "Clinic Name";
                ddlClinicNames.DataBind();


                ddlClinicNames.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--Select--", ""));

                ddlClinicNames.ClearSelection();
                ddlClinicNames.SelectedIndex = 0;

                // ddlClinicNames_SelectedIndexChanged(null, null);
            }
            catch (Exception ex)
            {

            }

        }

        protected void GenerateReports_Click(object sender, EventArgs e)
        {
            ShowReport();
           
        }
        private void ShowReport()
        {
            //Reset

            RptVwrClinicWsieApointmentCount.Reset();
            //ddlClinicNames.Text,
            DataTable dt = GetData(Convert.ToDateTime(txtStartDatetime.Text), Convert.ToDateTime(txtEndDatetime.Text));


            RptVwrClinicWsieApointmentCount.Reset();
            RptVwrClinicWsieApointmentCount.LocalReport.ReportPath = "ClinicWiseAppointmentCount.rdlc";
            ReportDataSource rds = new ReportDataSource("ClinicWiseAppintmentCountDataSet", dt);

            RptVwrClinicWsieApointmentCount.LocalReport.DataSources.Add(rds);
            

            RptVwrClinicWsieApointmentCount.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(Subreport_AppointmentMonthCount);
            RptVwrClinicWsieApointmentCount.LocalReport.Refresh();
            //DataSource
            //Added For Sub Reports
            
            
            //Added For Sub Reports 
            

            
            //Path

            //Parameter
            ReportParameter[] RptParamsss = new ReportParameter[]
            {
          //  new ReportParameter("CLINIC_ID",ddlClinicNames.Text),
            new ReportParameter("START_DATETIME",Convert.ToDateTime(txtStartDatetime.Text).ToString()) ,
            new ReportParameter("END_DATETIME", Convert.ToDateTime(txtEndDatetime.Text).ToString()) 
            };
            //Refresh
            RptVwrClinicWsieApointmentCount.LocalReport.SetParameters(RptParamsss);
            RptVwrClinicWsieApointmentCount.LocalReport.Refresh();
        }

        //Added for Sub Reports
        //void localReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e)
        //{
        //    e.DataSources.Add(new ReportDataSource("AppointmentsMonthCount", SqlDs_RefsReportsSub));
        //}
        void Subreport_AppointmentMonthCount(object sender, SubreportProcessingEventArgs e)
        {
            string CLINIC_ID = e.Parameters["CLINIC_ID"].Values[0].ToString();
            string THERAPIST_ID = e.Parameters["THERAPIST_ID"].Values[1].ToString(); ;
            //TextBox1.Text, TextBox2.Text
            DataTable AppointmentMonthCountSubreport = GetDataSubReport(CLINIC_ID, THERAPIST_ID);
            ReportDataSource ds = new ReportDataSource("AppointmentsMonthCount", AppointmentMonthCountSubreport);
            //ds.DataSourceId = "ObjectDataSource1";





            //ds.Name = "AppointmentsMonthCount";
            e.DataSources.Add(ds);
            // e.DataSources.Add(new ReportDataSource("AppointmentsMonthCount",(object) AppointmentsMonthCountDataSet.SP_TCA_GET_APPOINTMENT_COUNT_BY_MONTHDataTable));
        }

        //Added For Sub Reports
        private DataTable GetData(DateTime START_DATETIME, DateTime END_DATETIME)
        {//string CLINIC_ID, 
            DataTable dt = new DataTable();
            string conString = ConfigurationManager.ConnectionStrings["TCAConnectionStringNew"].ConnectionString;
            using (SqlConnection con = new SqlConnection(conString))
            {
                con.Open();
                SqlCommand cmd1 = new SqlCommand("SP_TCA_GET_APPOINTMENT_CLINICWISE", con);
                cmd1.CommandType = CommandType.StoredProcedure;
              //  cmd1.Parameters.Add("@CLINIC_ID", SqlDbType.NVarChar).Value = CLINIC_ID;
                cmd1.Parameters.Add("@START_DATETIME", SqlDbType.DateTime).Value = START_DATETIME;
                cmd1.Parameters.Add("@END_DATETIME", SqlDbType.DateTime).Value = END_DATETIME;
                SqlDataAdapter adp = new SqlDataAdapter(cmd1);
                adp.Fill(dt);
                con.Close();
            }
            return dt;
           
        }
        private DataTable GetDataSubReport(string CLINIC_ID, string THERAPIST_ID)
        {
            DataTable dt = new DataTable();
            string conString = ConfigurationManager.ConnectionStrings["TCAConnectionStringNew"].ConnectionString;
            using (SqlConnection con = new SqlConnection(conString))
            {
                con.Open();
                SqlCommand cmd1 = new SqlCommand("SP_TCA_GET_APPOINTMENT_COUNT_BY_MONTH", con);
                cmd1.CommandType = CommandType.StoredProcedure;
                cmd1.Parameters.Add("@CLINIC_ID", SqlDbType.NVarChar).Value = CLINIC_ID;
                cmd1.Parameters.Add("@THERAPIST_ID", SqlDbType.NVarChar).Value = THERAPIST_ID;
                SqlDataAdapter adp = new SqlDataAdapter(cmd1);
                adp.Fill(dt);
                con.Close();
            }
            return dt;
        }

 
       
    }
}

OriginalGriff

Какая ошибка?
Есть сообщение?

0 Ответов