加载报表失败 - Crystal Report in c# [英] Load report failed- Crystal Report in c#

查看:273
本文介绍了加载报表失败 - Crystal Report in c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在VS2012的C#中有此应用程序,我需要在其中生成Crystal Report 13.0.x.这个应用程序已经运行良好2年左右。


I have this application in C# on VS2012, in which I need to generate Crystal Report 13.0.x. This application has been running fine for last 2 years or so . Recently did some addons and after that its giving error

最近做了一些插件,之后发生错误

Load Report Fail


然而奇怪的是,在一个大约100倍的日子里,这个Crystal报表被生成,在它之间它给出了错误。在整个应用程序必须退出后,它工作正常。因为这个我不能复制我的错误结束。

这里我的代码:

However strange thing is that , in a day around 100 times this Crystal report is generated and in between it gives out that error. After the whole application has to be exited and then it works fine too. Because of this I am not abel to replicate the error at me end.
Here my code:

   public partial class ChangeOrderList : Form
{
    ConnectionClass connectionclass = new ConnectionClass();
    NewOrderBL NObl = new NewOrderBL();
    DailySalesReportBL DSRbl = new DailySalesReportBL();
    public ChangeOrderList()
    {
        InitializeComponent();
    }
    private void ChangeOrderList_Load(object sender, EventArgs e)
    {
        /////////////////////////To count Lunch Buffet///////////////////

        DataTable dtlb = DSRbl.selectBuffet(DateTime.Today.Date.ToString(), DateTime.Today.Date.ToString());
        string date = dtlb.Rows[0][0].ToString();


        ////////////////////////////////////////////////////////////////
        try
        {

            string sqlqry = "Select KOTNo,TableNo,WaiterName,ItemCode,ItemName,Quantity,Status,Foodtype from tblOrderChange where KOTNo=@kotno and Quantity>'0.00' and (Category!='Appetizer' and Category!='Indian Breads' and Category!='Desserts' and Category!='Beverages' and Category!='Tandoori')";
            SqlCommand cmd = new SqlCommand(sqlqry, connectionclass.con);
            cmd.Parameters.AddWithValue("@kotno", NewOrderBL.KOTNo);
            SqlDataAdapter adapter = new SqlDataAdapter(cmd);


            DataSet1 ds = new DataSet1();
            adapter.Fill(ds, "tblOrderChange");
            if (ds.Tables["tblOrderChange"].Rows.Count == 0)
            {
                MessageBox.Show("No Data Found", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            if (deliverybl.order == "Delivery")
            {
                //PrintDelivery printorder = new PrintDelivery();
                ChangeOrderdelivery printorder = new ChangeOrderdelivery();
                printorder.SetDataSource(ds);
                crystalReportViewer1.ReportSource = printorder;
                System.Drawing.Printing.PrintDocument printDocument = new System.Drawing.Printing.PrintDocument();
                printorder.PrintOptions.PrinterName = printDocument.PrinterSettings.PrinterName;
                printorder.PrintOptions.PrinterName = "EPSON TM-U220 Receipt";
                printorder.PrintToPrinter(1, false, 0, 0);
            }
            else
            {
                crystalReportViewer1.RefreshReport();
                ParameterFields paramFields = new ParameterFields();
                ParameterField paramField = new ParameterField();
                ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
                paramField.Name = "LBqty";
                paramDiscreteValue.Value = date;
                paramField.CurrentValues.Add(paramDiscreteValue);
                paramFields.Add(paramField);

                PrintChangeOrderList printchangeorder = new PrintChangeOrderList();
                printchangeorder.SetDataSource(ds);
                printchangeorder.SetParameterValue("LBqty", date);
                crystalReportViewer1.ReportSource = printchangeorder;
                System.Drawing.Printing.PrintDocument printDocument = new System.Drawing.Printing.PrintDocument();
                printchangeorder.PrintOptions.PrinterName = printDocument.PrinterSettings.PrinterName;
                printchangeorder.PrintOptions.PrinterName = "EPSON TM-U220 Receipt";
                printchangeorder.PrintToPrinter(1, false, 0, 0);
            }



        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        finally { connectionclass.disconnect(); }
        onlinebl.crystalreport = "";

        this.DialogResult = DialogResult.OK;

    }

    private void btnExit_Click(object sender, EventArgs e)
    {
        onlinebl.crystalreport = "";

        this.DialogResult = DialogResult.OK;

    }

我一直在敲我的头。每一个我在搜索它说的路径,我不使用任何地方的路径,所以不能了解故障在哪里。
如果你需要任何更多的信息或代码,请让我知道。感谢

I have been banging my head for long . Every where I search it says about the path and I am not using the path anywhere so not able to understand where the fault is. If you need any more info or the code please let me know. Thanks

推荐答案

我刚刚删除了Internet临时文件,之后客户端还没有抱怨错误。所以,如果它解决了

I just deleted internet temp files and after that client has not yet complained about the error. So I am keeping an eye on it if it resolved the issue

这篇关于加载报表失败 - Crystal Report in c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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