Quantcast
Viewing all articles
Browse latest Browse all 1507

crystal report Missing Parameter Values Error?

Hi All,

I am making report with asp.net and crystal report in vs2010.

I am getting 

Missing parameter values error.

I am using Stored Procedure in crystal report and it having 3 parameters and my crystal report looks like this

https://plus.google.com/114925945652351521105/posts/9dKU8UWYhBi?pid=6183843565391658114&oid=114925945652351521105#114925945652351521105/posts/9dKU8UWYhBi?pid=6183843565391658114&oid=114925945652351521105

I am Using Below Code.

 ReportDocument rptdoc;

private void SearchStudent()
    {
        rptdoc.Load(Server.MapPath("~/CrystalReports/Attendance/SPresent.rpt"));
        rptdoc.FileName = Server.MapPath("~/CrystalReports/Attendance/SPresent.rpt");
        CrystalReportViewer1.ReportSource = null;
        CrystalReportViewer1.RefreshReport();
        ViewState["AttDate"] = Convert.ToDateTime(txtDate.Text.Trim());
     ViewState["ClassName"] = ddlClass.SelectedItem.Text;   
        ViewState["type"] = "p";     
       ViewState["classid"] = Convert.ToInt64(ddlClass.SelectedValue.ToString());    
       ViewState["ReportName"] = "~/CrystalReports/Attendance/SPresent.rpt";


        TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
        TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
        ConnectionInfo crConnectionInfo = new ConnectionInfo();
        Tables CrTables;
        String s = ConfigurationManager.ConnectionStrings["Db"].ConnectionString.ToString();

        rptdoc.SetParameterValue(0, (txtDate.Text.Trim()));
        rptdoc.SetParameterValue(1, "p");
        rptdoc.SetParameterValue(2, Convert.ToInt64(ddlClass.SelectedValue.ToString()));

        crConnectionInfo.ServerName = s.Substring(s.IndexOf('=') + 1, s.IndexOf(';') - (s.IndexOf('=') + 1));
        s = s.Substring(s.IndexOf(';') + 1);
        crConnectionInfo.DatabaseName = s.Substring(s.IndexOf('=') + 1, s.IndexOf(';') - (s.IndexOf('=') + 1));
        s = s.Substring(s.IndexOf('U'));
        crConnectionInfo.UserID = s.Substring(s.IndexOf('=') + 1, (s.LastIndexOf(';') - s.IndexOf('=')) - 1);
        s = s.Substring(s.IndexOf(';'));
        crConnectionInfo.Password = s.Substring(s.IndexOf('=') + 1);


        CrTables = rptdoc.Database.Tables;
        foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
        {
            crtableLogoninfo = CrTable.LogOnInfo;
            crtableLogoninfo.ConnectionInfo = crConnectionInfo;
            CrTable.ApplyLogOnInfo(crtableLogoninfo);
        }

        CrystalReportViewer1.ReportSource = rptdoc;
        //   crystalReportViewer1.LogOnInfo[0].ConnectionInfo.IntegratedSecurity = true;
        CrystalReportViewer1.Visible = true;
    }
 protected void LbSearch_Click(object sender, EventArgs e)
    {
        try
        {

            SearchStudent();
            ddlClass.Focus();
        }
        catch (Exception ex)
        {
            SuccessMessage("Exception:" + ex.Message.ToString());
        }
    }
 protected void Page_Unload(object sender, EventArgs e)
    {
        if (rptdoc != null)
        {
            rptdoc.Close();
            rptdoc.Dispose();
        }
    }

how to slove this issue?


Viewing all articles
Browse latest Browse all 1507

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>