The request could not be submitted for background
I have a problem with CR for VS 2005.
Before view the report, i change in runtime the images in the report with another image in my PC and the error is :
Error in File C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\1\CrystalReport {850CE782-3783-4DE9-A935-38C57A8955B3}.rpt:
The request could not be submitted for background processing.
and the code is:
//begin
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using CrystalDecisions.CrystalReports.Engine;
using System.Data.SqlClient;
using System.Configuration;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
private ReportDocument oRpt;
protected void Page_Load(object sender, EventArgs e)
{
}
public ReportDocument ORpt
{
get { return oRpt; }
set { oRpt = value; }
}
private void Exportar(string formato)
{
System.IO.Stream rptStream = this.ORpt.ExportToStream(CrystalDecisions.Shared.E xportFormatType.PortableDocFormat);
string contentType = "application/pdf";
if (formato == "WORD")
{
rptStream = this.ORpt.ExportToStream(CrystalDecisions.Shared.E xportFormatType.WordForWindows);
contentType = "application/msword";
}
if (formato == "EXCEL")
{
rptStream = this.ORpt.ExportToStream(CrystalDecisions.Shared.E xportFormatType.Excel);
contentType = "application/vnd.ms-excel";
}
this.ORpt.Close();
System.IO.BinaryReader br = new System.IO.BinaryReader(rptStream);
byte[] dataBytes = new byte[rptStream.Length];
for (int i = 0; i < rptStream.Length; ++i)
dataBytes[i] = br.ReadByte();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = contentType;
Response.BinaryWrite(dataBytes);
Response.Flush();
Response.Close();
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlCommand command;
SqlParameter sqlParam;
string param;
string cnnString = ConfigurationManager.AppSettings["connectionstring"];
SqlConnection connection = new SqlConnection(cnnString);
connection.Open();
command = new SqlCommand();
command.CommandText = "SELECT top 10 trademark, appno, digital, id FROM BulletinTrademarks ";
command.CommandType = CommandType.Text;
command.Connection = connection;
SqlDataAdapter dataAdapter = new SqlDataAdapter(command);
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet, "BulletinTrademarks");
this.ArmarLogos(dataSet, true);
this.ORpt = new ReportDocument();
this.ORpt.FileName = ConfigurationManager.AppSettings["reportspath"] + "CrystalReport.rpt";
this.ORpt.SetDataSource(dataSet);
this.Exportar("PDF");
}
protected void Button2_Click(object sender, EventArgs e)
{
this.Response.Redirect("viewer.aspx");
}
public void ArmarLogos(DataSet ds, bool logotipo)
{
if (logotipo)
{
string ubicacion = "G:\\NET\\visual studio 2005\\WebSites\\WebSiteImageTest\\";
foreach (DataRow dr in ds.Tables["BulletinTrademarks"].Rows)
{
string archivo = ubicacion + "97_000084.jpg";
if (!File.Exists(archivo))
archivo = ubicacion + "px.jpg";
try
{
FileStream fs = new FileStream(archivo, FileMode.Open); // create a file stream
BinaryReader br = new BinaryReader(fs);
//dr[33] = br.ReadBytes((int)br.BaseStream.Length);
dr[2] = br.ReadBytes((int)br.BaseStream.Length);
fs.Close();
br = null;
fs = null;
}
catch (Exception ex)
{
string a = ex.Message;
}
}
}
}
}
//end
Even in a viewer it doesn't work.
and I installed SP3 & SP4 and the hotfix
- cr10win_en.zip
- common10win_en.zip
Somebody can help me, please
|