读书人

水晶报表:无法将请求提交给后台处理解

发布时间: 2012-01-02 22:40:04 作者: rapoo

水晶报表:无法将请求提交给后台处理
错误提示如下:文件C:\WINDOWS\TEMP\SaleQuoteModulPush{92EAE361-71E6-4EBF-B97F...}.rpt内出错:无法将请求提交给后台处理

但有时刷新后可以正常显示,有时不能。。。目前发现只有有图片的水晶报表才报这类错误。。
我水晶报表后台代码:

C# code
using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Data.SqlClient;using System.IO;public partial class RptCenter_CrystalReport_OrderUtitityPushRpt : System.Web.UI.Page{    protected void Page_Load(object sender, EventArgs e)    {        string orderNo=Request.QueryString["OrderNo"];        DataSet ds = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, "rpt_SaleQuoteModul", new SqlParameter("@OrderNo", orderNo));                DataSet FillDetaSet = this.defineDataSet();               for (int i = 0; i < ds.Tables[0].Rows.Count; i++)        {            addrow(ds, FillDetaSet, i);                            }        fillRpt(FillDetaSet);    }    private DataSet defineDataSet()    {        //定义填充DataSet与SaleQuoteModulRpt.xsd呼应        DataSet FillDetaSet = new DataSet();        FillDetaSet.Tables.Add("dt");//与SaleQuoteModulRpt.xsd table同名        FillDetaSet.Tables[0].Columns.Add("CustomerNo", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("CustomerName", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("Salesman", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("SalesmanName", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("OrderNo", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("QuoteDate", typeof(System.DateTime));        FillDetaSet.Tables[0].Columns.Add("ValidDate", typeof(System.DateTime));        FillDetaSet.Tables[0].Columns.Add("DeliveryTerm", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("PaymentTerm", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("State", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("StatutoryFee", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("TransportType", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("NoteText", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("Creater", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("PartNo", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("PartDesc", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("PartModel", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("UnitMeas", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("UnitPrice", typeof(System.Decimal));        FillDetaSet.Tables[0].Columns.Add("PayType", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("NoteTextLine", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("PicName", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("FilePath", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("Photograph", typeof(System.Byte[]));        FillDetaSet.Tables[0].Columns.Add("EntFullName", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("Address", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("Tel", typeof(System.String));        FillDetaSet.Tables[0].Columns.Add("Fax", typeof(System.String));        return FillDetaSet;    }    public void addrow(DataSet ds, DataSet FillDetaSet, int i)    {                DataRow row = FillDetaSet.Tables[0].NewRow();              row["CustomerNo"] = ds.Tables[0].Rows[i]["CustomerNo"].ToString();        row["CustomerName"] = ds.Tables[0].Rows[i]["CustomerName"].ToString();        row["Salesman"] = ds.Tables[0].Rows[i]["Salesman"].ToString();        row["SalesmanName"] = ds.Tables[0].Rows[i]["SalesmanName"].ToString();        row["OrderNo"] = ds.Tables[0].Rows[i]["OrderNo"].ToString();        row["QuoteDate"] =(DateTime)ds.Tables[0].Rows[i]["QuoteDate"];        row["ValidDate"] = (DateTime)ds.Tables[0].Rows[i]["ValidDate"];        row["DeliveryTerm"] = ds.Tables[0].Rows[i]["DeliveryTerm"].ToString();        row["PaymentTerm"] = ds.Tables[0].Rows[i]["PaymentTerm"].ToString();             row["State"] = ds.Tables[0].Rows[i]["State"].ToString();               row["StatutoryFee"] = ds.Tables[0].Rows[i]["StatutoryFee"].ToString();        row["TransportType"] = ds.Tables[0].Rows[i]["TransportType"].ToString();        row["NoteText"] = ds.Tables[0].Rows[i]["NoteText"].ToString();        row["Creater"] = ds.Tables[0].Rows[i]["Creater"].ToString();           row["PartNo"] = ds.Tables[0].Rows[i]["PartNo"].ToString();        row["PartDesc"] = ds.Tables[0].Rows[i]["PartDesc"].ToString();        row["PartModel"] = ds.Tables[0].Rows[i]["PartModel"].ToString();        row["UnitMeas"] = ds.Tables[0].Rows[i]["UnitMeas"].ToString();        row["UnitPrice"] = (Decimal)ds.Tables[0].Rows[i]["UnitPrice"];        row["PayType"] = ds.Tables[0].Rows[i]["PayType"].ToString();        row["NoteTextLine"] = ds.Tables[0].Rows[i]["NoteTextLine"].ToString();        row["PicName"] = ds.Tables[0].Rows[i]["PicName"].ToString();        row["FilePath"] = ds.Tables[0].Rows[i]["FilePath"].ToString();        if (ds.Tables[0].Rows[i]["PicName"].ToString() != "")        {            try            {                string path = Server.MapPath(ds.Tables[0].Rows[i]["FilePath"].ToString());                FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);                BinaryReader br = new BinaryReader(fs);                                row["Photograph"] = br.ReadBytes((int)br.BaseStream.Length);                fs.Close();            }            catch(Exception ex)            {                string path = Server.MapPath(@"~\UpLoad\Photograph.jpg");                FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);                BinaryReader br = new BinaryReader(fs);                               row["Photograph"] = br.ReadBytes((int)br.BaseStream.Length);                fs.Close();            }        }        else        {            row["Photograph"] = DBNull.Value;        }        row["EntFullName"] = ds.Tables[0].Rows[i]["EntFullName"].ToString();        row["Address"] = ds.Tables[0].Rows[i]["Address"].ToString();        row["Tel"] = ds.Tables[0].Rows[i]["Tel"].ToString();        row["Fax"] = ds.Tables[0].Rows[i]["Fax"].ToString();        FillDetaSet.Tables[0].Rows.Add(row);    }    public void fillRpt(DataSet ds)    {        ds.ReadXmlSchema(Server.MapPath("~/RptCenter/RptModul/SaleQuoteModulRpt.xsd"));        crs.ReportDocument.Load(Server.MapPath("SaleQuoteModulPush.rpt"));        crs.ReportDocument.SetDataSource(ds);               crs.DataBind();        crv.ReportSource = crs;        crv.DataBind();        ds.Dispose();    }} 


前台代码:
HTML code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SaleQuoteModulPush.aspx.cs" Inherits="RptCenter_CrystalReport_OrderUtitityPushRpt" %><%@ Register Assembly="CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"    Namespace="CrystalDecisions.Web" TagPrefix="CR" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head id="Head1" runat="server">    <title>报表管理器</title>       <link href="/aspnet_client/System_Web/2_0_50727/CrystalReportWebFormViewer3/css/default.css"        rel="stylesheet" type="text/css" /></head><body>    <form id="form1" runat="server">     <object style="display:none"  id="Object1" classid="CLSID:BAEE131D-290A-4541-A50A-8936F159563A" codebase="PrintControl.cab" #Version="10.2.0.1146" viewastext></object>      <CR:CrystalReportViewer ID="crv" runat="server" AutoDataBind="True"            DisplayGroupTree="False" EnableDatabaseLogonPrompt="False" Height="50px"             Width="350px" PrintMode="ActiveX"/>        <CR:CrystalReportSource ID="crs" runat="server">                    </CR:CrystalReportSource>      </form></body></html>


[解决办法]
代码上应该没问题。主要还是水晶报表对图片的处理方法问题导致的。

参考以下几个帖子看看,主要是配置 config节及一个handler文件的处理
注意需仔细看下帖子内容,并不是只有得分的回复才有价值。

帖子1:
http://topic.csdn.net/u/20090921/14/5b92bd14-c02d-4ece-97e3-7c3a093406c0.html

帖子2:
http://topic.csdn.net/u/20100526/16/615aeaf7-1882-436b-ba6a-d834b17a826a.html

帖子3:
http://topic.csdn.net/u/20101230/10/193e5b08-e08c-4c52-ac3a-dd998ee3f0a9.html


读书人网 >.NET

热点推荐