Errore Crystal Report

giovedì 02 agosto 2012 - 16.33

LuigiJin Profilo | Newbie

Salve, ho un errore di questo tipi:

Logon failed.Error in File C:\WINDOWS\TEMP\ReportElencoDifettiMarelli {7A7DF568-DF94-4C24-8FF7-403D28CF2126}.rpt:
Unable to connect: incorrect log on parameters.
Descrizione: Eccezione non gestita durante l'esecuzione della richiesta Web corrente. Per ulteriori informazioni sull'errore e sul suo punto di origine nel codice, vedere l'analisi dello stack.

Dettagli eccezione: System.Runtime.InteropServices.COMException: Logon failed.Error in File C:\WINDOWS\TEMP\ReportElencoDifettiMarelli {7A7DF568-DF94-4C24-8FF7-403D28CF2126}.rpt:
Unable to connect: incorrect log on parameters.

Errore nel codice sorgente:


Riga 84: report.Refresh();
Riga 85:
Riga 86: report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, System.Web.HttpContext.Current.Server.MapPath("~/Marelli2/StampaSchedaLavoro/") + @"\" + MyIdScheda + "Dif.pdf");
Riga 87:
Riga 88: Response.ContentType = "application/pdf";

non riesco a risolvere il problema.


questo è il mio codice

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CrystalDecisions.CrystalReports.Engine;
using System.Data.OleDb;
using System.Data;
using CrystalDecisions.Shared;

public partial class _Default : System.Web.UI.Page
{



protected void Page_Load(object sender, EventArgs e)
{
string MyIdScheda = Request.QueryString["IdScheda"];
string MyIdUtente = Request.QueryString["IdUtente"];



ReportDocument report = new ReportDocument();

string reportPath = System.Web.HttpContext.Current.Server.MapPath("~/") + @"\Report.rpt";


OleDbConnection conn = new OleDbConnection("Stringa");




string sql = @"SELECT * From Tab";


OleDbDataAdapter adapter = new OleDbDataAdapter(sql, conn);
DataSet dataSet = new DataSet();
adapter.Fill(dataSet);

report.Load(reportPath);
report.DataSourceConnections[0].SetConnection("NomeServer", "DB", "User", "Psw");


report.SetDataSource(dataSet.Tables[0]);


report.Refresh();

report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, System.Web.HttpContext.Current.Server.MapPath("~/") + @"\" + MyIdScheda + "Dif.pdf");

Response.ContentType = "application/pdf";
Response.Redirect("~/" + MyIdScheda + "Dif.pdf");
Response.End();
}
}
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5