Visual Studio .NET - .net - Asked By Ashish Acharya on 14-Mar-13 01:52 AM

In my windows application crystal report ,i am passing 3 parameters through programetically but after run my application one prompt windows box is display and asking parameters ,how to ignore it,

here is my code...


  private void btn_show_Click(object sender, EventArgs e)
        {
            crystalReportViewer1.Visible = true;
            SqlConnection con = new SqlConnection(ATHMA.RECON.Properties.Settings.Default.SqlConnectionString);


            
            con.Open();
            SqlCommand cmd = new SqlCommand("Sp_test", con);
            cmd.CommandType = CommandType.StoredProcedure;
            // cmd.Parameters.AddWithValue("@TERMINALID", comboBox1.SelectedIndex.ToString());
            //cmd.Parameters.AddWithValue("@TERMINALID", comboBox1.SelectedValue.ToString());
            cmd.Parameters.AddWithValue("@TERMINALID", comboBox1.Text.ToString());
            cmd.Parameters.AddWithValue("@TR_POSTDATE", Convert.ToDateTime(dateTimePicker1.Value));
            cmd.Parameters.AddWithValue("@TR_ENDDATE", Convert.ToDateTime(dateTimePicker2.Value));
            cmd.CommandTimeout = 180;
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet ds = new DataSet();
            da.Fill(ds);
            //serchvalue[0] = new SqlParameter("@TERMINALID", comboBox1.Text.ToString());
            //serchvalue[1] = new SqlParameter("@TR_POSTDATE", Convert.ToDateTime(dateTimePicker1.Value));
            //serchvalue[2] = new SqlParameter("@TR_ENDDATE", Convert.ToDateTime(dateTimePicker2.Value));
            //*******************************************************************************************************
            //ParameterFields pf = new ParameterFields();
            DailyReconReportMonthwise cryRpt = new DailyReconReportMonthwise();


            ParameterField paramField = new ParameterField();
            ParameterFields paramField1 = new ParameterFields();
            ParameterFields paramField2 = new ParameterFields();
            ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();


            paramField.Name = "@TERMINALID";
            paramDiscreteValue.Value = comboBox1.Text;
            paramField.CurrentValues.Add(paramDiscreteValue);
            paramField1.Add(paramField);
            Frm_dailyReconReportMonthwise fdr = new Frm_dailyReconReportMonthwise();
            //crystalReportViewer1.Load=cryRpt;
            
          //ParameterFieldDefinitions crParameterFieldDefinitions = default(ParameterFieldDefintions);
            //ParameterFieldDefinition crParameterFieldDefinition = default(ParameterFieldDefinition);
            //ParameterValues crParameterValues = new ParameterValues();
            //ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();


            //crParameterDiscreteValue.Value = comboBox1.Text;
            //crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
            //crParameterFieldDefinition = crParameterFieldDefinitions["@TERMINALID"];
            //crParameterValues = crParameterFieldDefinition.CurrentValues;


            //crParameterValues.Clear();
            //crParameterValues.Add(crParameterDiscreteValue);
            //crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);


            //*******************************************************************************************************
            // ds = SqlHelper.ExecuteDataset(con,"Sp_Test", serchvalue);


            //DailyReconReportMonthwise data = new DailyReconReportMonthwise();
            //ParameterDiscreteValue pd = new ParameterDiscreteValue();
            //ParameterFields pf = new ParameterFields();


           // pf.
            //pd.Value = comboBox1.Text;
            //pd.Value = Convert.ToDateTime(dateTimePicker1.Value);
            //pd.Value = Convert.ToDateTime(dateTimePicker2.Value);
            //data.ParameterFields["@TERMINALID"].CurrentValues.Add(pd);
            //data.ParameterFields["@TR_POSTDATE"].CurrentValues.Add(pd);
            //data.ParameterFields["@TR_ENDDATE"].CurrentValues.Add(pd);
            //data.SetParameterValue("@TERMINALID", comboBox1.Text);
            //data.SetParameterValue("@TR_POSTDATE",Convert.ToDateTime(dateTimePicker1.Value));
            //data.SetParameterValue("@TR_ENDDATE", Convert.ToDateTime(dateTimePicker2.Value));
            
            //data.SetDataSource(ds);
            ////crystalReportViewer1.ParameterFieldInfo = pd;
            //ReportDataSource data = new ReportDataSource("PROC_RPT_DailyReconReport_Test", ds.Tables[0]);
            //crystalReportViewer1.ParameterFieldInfo = comboBox1.Text;
            //crystalReportViewer1.ReportSource = data;
            ////reportViewer1.LocalReport.DataSources.Clear();
            //reportViewer1.LocalReport.DataSources.Add(data);


            if (ds.Tables[0].Rows.Count == 0)
            {


                MessageBox.Show("No Records Found", "MaxRecon");


            }
            crystalReportViewer1.Refresh();
}