ExportToHttpResponse失败{无法评估表达式,因为代码已优化或本机框架位于调用堆栈之上} [英] ExportToHttpResponse Failing {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack}

查看:105
本文介绍了ExportToHttpResponse失败{无法评估表达式,因为代码已优化或本机框架位于调用堆栈之上}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我是C#编程新手,我面临无法评估表达式,因为代码已优化或本机框架位于调用堆栈顶部当我生成PDF格式的晶体报表时,我的项目中的消息,PDF也不是Generating我在谷歌搜索了答案,也见过许多链接,但没有任何帮助我可以告诉我什么是错误



守则我试过了,



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)
    {
        try
        {
            Response.Buffer = false;
            Response.ClearContent();
            Response.ClearHeaders();
            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";

                ds.WriteXml(Server.MapPath("~/XML/Passkeys.xml"));
                string filename = Server.MapPath("~/Upload/Pkey_rpt.rpt");
                rpt.Load(filename);
                rpt.SetDataSource(ds);
                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...";

                }
                else
                {

                    lblmsg.Text = "There is No Schedule for the Selected date....";
                }

            }
         }

        }
        catch (Exception ex)
        {
            lblmsg.Text = ex.Message;
        }
    }

}

推荐答案

这里已解决的主题 [ ^ ]


这篇关于ExportToHttpResponse失败{无法评估表达式,因为代码已优化或本机框架位于调用堆栈之上}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆