none
Moss 2007 CrystallReport Error RRS feed

  • Question

  • I have developed a .net WebPage using VS 2005 & C#,I have a report that display Axapta ERP CustTable.The Code is shown:

    using System;
    using System.Collections;
    using System.Configuration;
    using System.Data;
    using System.Data.SqlClient;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using CrystalDecisions.CrystalReports.Engine;
    using CrystalDecisions.Shared;  

    public partial class CustomPages_CustTableFromTo : System.Web.UI.Page
    {
        private DataSet ds = null;
        private string strConn="";
        private string strSqlCmd = "";
        private SqlConnection conn = null;
        private SqlCommand cmd = null;
        private SqlDataAdapter dap = null;
        private string dataAreaId = "";


        protected void Page_Load(object sender, EventArgs e)
        {
            string ConnName = this.Request.QueryString["ConnName"];//ConnectionString Name
            strConn = ConfigurationManager.ConnectionStrings[ConnName].ConnectionString;
            dataAreaId = this.Request.QueryString["DataAreaId"];//DataAreaId

            if (this.IsPostBack)
                this.Rpt_Bind();

        }
        protected void BtnDispayRpt_Click(object sender, EventArgs e)
        {
            this.Rpt_Bind();
        }

        protected void Rpt_Bind()
        {
            string CustFrom;
            string CustTo;
            ReportDocument RptRD = new ReportDocument();

            CustFrom = this.TxtCustAccountFrom.Text;
            CustTo = this.TxtCustAccountTo.Text;
            if (CustFrom.Length == 0)
                CustFrom = "";
            if (CustTo.Length == 0)
                CustTo = "";
            strSqlCmd = "Select AccountNum,Name From CustTable Where Ltrim(AccountNum)>='" + CustFrom + "' and (Ltrim(AccountNum) <='" + CustTo + "' or ''='" + CustTo + "') ";
            strSqlCmd += " and dataareaid='" + dataAreaId + "'";
            //获取数据
            conn = new SqlConnection(strConn);
            //try
            //{
                cmd = new SqlCommand(strSqlCmd, conn);
                conn.Open();
                dap = new SqlDataAdapter(cmd);
                ds = new DataSet();
                dap.Fill(ds, "CustTable");
                Response.Write(ds.Tables[0].Rows.Count.ToString());
                string info = Server.MapPath("CustTableFromTo.rpt").Replace(@"\", @"\\");
                //Response.Write("<script type='text/javascript' >" + "alert('" + info + "');</script>");
                RptRD.Load(info);
                Response.Write(info);
                RptRD.SetDataSource(ds);
                RptView.ReportSource = RptRD;           
                RptView.DataBind();

            //}
            /*
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
            */
        }

        protected void BtnReturn_Click(object sender, EventArgs e)
        {
            string str;
            str = this.Request.QueryString["id"];//"http://testsrv2/Lists/ERP/AllItems.aspx";
            this.Response.Redirect(str);
        }
    }
     
    The Errors is Shown:

     Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Runtime.InteropServices.COMException: 未知的查询引擎错误文件 C:\WINDOWS\TEMP\CustTableFromTo {49F32B55-3F5D-4ABB-9C4D-11411395C3BD}.rpt 内出错:
    未知的查询引擎错误

    Source Error:

    Line 67:             RptRD.Load(info);
    Line 68:             Response.Write(info);
    Line 69:             RptRD.SetDataSource(ds);
    Line 70:             RptView.ReportSource = RptRD;            
    Line 71:             RptView.DataBind();

    Source File: c:\Inetpub\wwwroot\wss\VirtualDirectories\80\CustomPages\CustTableFromTo.aspx.cs    Line: 69

    Stack Trace:

    [COMException (0x800002c2): 未知的查询引擎错误
    文件 C:\WINDOWS\TEMP\CustTableFromTo {49F32B55-3F5D-4ABB-9C4D-11411395C3BD}.rpt 内出错:
    未知的查询引擎错误]
       CrystalDecisions.ReportAppServer.Controllers.DatabaseControllerClass.ReplaceConnection(Object oldConnection, Object newConnection, Object parameterFields, Object crDBOptionUseDefault) +0
       CrystalDecisions.CrystalReports.Engine.Table.SetDataSource(Object val, Type type) +691
       CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type) +121
    
    [DataSourceException: 未知的查询引擎错误
    文件 C:\WINDOWS\TEMP\CustTableFromTo {49F32B55-3F5D-4ABB-9C4D-11411395C3BD}.rpt 内出错:
    未知的查询引擎错误]
       CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e) +285
       CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type) +188
       CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataSet dataSet) +66
       CustomPages_CustTableFromTo.Rpt_Bind() in c:\Inetpub\wwwroot\wss\VirtualDirectories\80\CustomPages\CustTableFromTo.aspx.cs:69
       CustomPages_CustTableFromTo.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\wss\VirtualDirectories\80\CustomPages\CustTableFromTo.aspx.cs:33
       System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
       System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
       System.Web.UI.Control.OnLoad(EventArgs e) +99
       System.Web.UI.Control.LoadRecursive() +50
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
    

    Server Error in '/' Application.

    未知的查询引擎错误文件 C:\WINDOWS\TEMP\CustTableFromTo {49F32B55-3F5D-4ABB-9C4D-11411395C3BD}.rpt 内出错:
    未知的查询引擎错误

     

    • Moved by Harry Zhu Wednesday, December 16, 2009 7:49 AM (From:Crystal Reports for Visual Studio)
    Tuesday, December 15, 2009 3:21 AM

All replies