Click here to Skip to main content
13,050,358 members (138,217 online)
Rate this:
Please Sign up or sign in to vote.
See more: , +
First of all I am New to C# Programming, I am facing the Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack Message in my project when I Generate the crystal Report in PDF Format, also the PDF is not Generating I had searched for Answers in Google and also seen many links but nothing helped me could anyone tell me what would be the Mistake

The Code I tried is,

protected void getpkeybt_Click(object sender, EventArgs e)
    bool ch = checkFromToDate();
    int i=checkTxt();
    if ( ch == true && i==1)
            Response.Buffer = false;
            ReportDocument rpt = new ReportDocument();
            DateTime dt = DateTime.Parse(frmtxtdt.Text);
            DateTime dt1 = DateTime.Parse(frmtxtdt.Text);
            string frtxt = String.Format("{0:MM-dd-yyyy}", dt);
            string totxt = String.Format("{0:MM-dd-yyyy}", dt1);
            DataSet ds = Namespace.SP.EStoredprocedure(frtxt,totxt).GetDataSet();
            if (!IsPageRefresh)
            if (ds.Tables[0].Rows.Count > 0
                && frtxt == ds.Tables[0].Rows[0]["Date"].ToString()
                && totxt == ds.Tables[0].Rows[0]["Date"].ToString())
                ds.Tables[0].TableName = "Passkeys";
                string filename = Server.MapPath("~/Upload/Pkey_rpt.rpt");
                rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Passkeys");
            else if(frmtxtdt.Text.Trim() !=null && totxtdt.Text.Trim()!=null)
                if (frtxt   == ds.Tables[0].Rows[0]["Date"].ToString()
                     && totxt == ds.Tables[0].Rows[0]["Date"].ToString() 
                     && ds.Tables[0].Rows.Count == 0)
                    lblmsg.Text = "Pass Key Not Yet Delivered for the Selected Date...";
                    lblmsg.Text = "There is No Schedule for the Selected date....";
        catch (Exception ex)
            lblmsg.Text = ex.Message;
Posted 10-Jun-13 21:12pm
Updated 10-Jun-13 21:13pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 20 Oct 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100