水晶报告没有显示我的记录

时间:2013-07-11 16:08:06

标签: c# visual-studio-2012 crystal-reports-2011

我在我的应用程序中使用了Crystal Report 13,它在简单的表中运行良好,但在特定场景中:我有一个表,当我加载此表时通过存储过程加载,然后报告将被调用,之后显示报告我使用删除查询清理表。如果我评论该查询报告显示记录否则出现空报告。请看我的代码:

private void btnPreview_Click(System.Object sender, System.EventArgs e)
    {
        if (IsErrorFound() == false)
        {
            MyResources.WaitDialogCreate("Loading....");
            string FormulaString = "";
            string Parameters = "";

            //***** Insert Data in table naamed tblReportTrialBalanceWith (With and Without Of Opening Bal) FROM Store Procedure
            string Qry = "INSERT INTO tblReportTrialBalanceWithOpening EXEC [spTrialBalance] @MinFY = '" + GlobalVriables.FYearDateStart.Year.ToString() + "'," +
            "@MaxFY = '" + GlobalVriables.FYearDateEnd.Year.ToString() + "'," +
            "@DateFrom = '" + MyResources.getDateForDB(dteFromDate.Text.Trim()) + "'," +
            "@DateTo = '" + MyResources.getDateForDB(dteToDate.Text.Trim()) + "'," +
            "@FromCode = '" + lkpFromCode.Text.Trim() + "'," +
            "@ToCode = '" + lkpToCode.Text.Trim() + "'," +
            "@Category = '" + rdoAccCategory.Text.Trim() + "'";

            DatabaseHelper.ExecuteNonQuery(Qry);

            if (chkWithOutOB.Checked == true)
            {

                //************* Parameters
                Parameters = "CompanyName=" + GlobalVriables.CompanyName + 
                    "&StartingDate=" + dteFromDate.Text +
                    "&EndingDate=" + dteToDate.Text +
                    "&Category=" + (rdoAccCategory.SelectedIndex == 0 ? "All Categories" : rdoAccCategory.Text.Trim()) + 
                    "&FYear=[" + GlobalVriables.FYearDateStart.Year + "-" + GlobalVriables.FYearDateEnd.Year + "]";
                switch (rdoAccCategory.SelectedIndex)
                {
                    case 0:
                        Parameters = Parameters + "&ReportCase=0";
                        break;
                    case 2:
                        Parameters = Parameters + "&ReportCase=2";
                        break;
                    default:
                        Parameters = Parameters + "&ReportCase=1";
                        break;
                }
                MyResources.ViewReport("RptTrialBalanceWithOutOB.rpt", FormulaString, Parameters);
                ////***** Clean up tblReportTrialBalanceWithOpening for Future use.
                //Qry = "DELETE FROM tblReportTrialBalanceWithOpening";
                //DatabaseHelper.ExecuteNonQuery(Qry);
            }
            else
            {
                //************* Parameters
                Parameters = "CompanyName=" + GlobalVriables.CompanyName + 
                    "&StartingDate=" + dteFromDate.Text.Trim() + 
                    "&EndingDate=" + dteToDate.Text +
                    "&Category=" + (rdoAccCategory.SelectedIndex == 0 ? "All Categories" : rdoAccCategory.EditValue.ToString()) + 
                    "&FYear=[" + GlobalVriables.FYearDateStart.Year + "-" + GlobalVriables.FYearDateEnd.Year + "]";
                switch (rdoAccCategory.SelectedIndex)
                {
                    case 0:
                        Parameters = Parameters + "&ReportCase=0";
                        break;
                    case 2:
                        Parameters = Parameters + "&ReportCase=2";
                        break;
                    default:
                        Parameters = Parameters + "&ReportCase=1";
                        break;
                }
                MyResources.ViewReport("RptTrialBalance.rpt", FormulaString, Parameters);
                ////***** Clean up tblReportTrialBalanceWithOpening for Future use.
                //Qry = "DELETE FROM tblReportTrialBalanceWithOpening";
                //DatabaseHelper.ExecuteNonQuery(Qry);
            }
            MyResources.WaitDialogDispose();
            //***** Clean up tblReportTrialBalanceWithOpening for Future use.
            Qry = "DELETE FROM tblReportTrialBalanceWithOpening";
            DatabaseHelper.ExecuteNonQuery(Qry);
        }

    }

如果我发表评论,你可以看到我的删除查询。我的报告显示了记录。在我的情况下必须删除查询。所以请帮助我,我总是分散。还记得我的应用程序从2010年升级到2012年的视觉工作室成功地期待这个问题。

0 个答案:

没有答案