Mesdames et Messieurs,
J'ai trouvé la solution après maintes tentatives et recherches.
En fait, j'ai utilisé une classe spéciale en utilisant une classe nommé CachedReport
Je poste mon code pour ceux qui rencontre ou ont rencontré le probleme :
Classe CachedReportusing System;
using System.ComponentModel;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.ReportSource;
using CrystalDecisions.Shared;
namespace IHM
{
public class CachedReport : Component, ICachedReport
{
protected ReportDocument Report = new ReportDocument();
protected bool isCacheable;
protected bool shareDBLogonInfo;
protected string reportName;
protected ParameterDiscreteValue parametre = new ParameterDiscreteValue();
protected TimeSpan cacheTimeOut;
public CachedReport(string s, ParameterDiscreteValue param)
{
reportName = s;
parametre = param;
}
public virtual Boolean IsCacheable
{
get
{
return isCacheable;
}
set
{
isCacheable = value;
}
}
public virtual Boolean ShareDBLogonInfo
{
get
{
return shareDBLogonInfo;
}
set
{
shareDBLogonInfo = value;
}
}
public virtual TimeSpan CacheTimeOut
{
get
{
return cacheTimeOut;
}
set
{
cacheTimeOut = value;
}
}
public virtual ReportDocument CreateReport()
{
try
{
Report.Load
(reportName, OpenReportMethod.OpenReportByTempCopy);
Report.Site = this.Site;
Report.SetParameterValue("discreteVal", parametre);
Report.SetDatabaseLogon("getec", "getec");
}
catch(SystemException exp)
{
MessageBox.Show(exp.Message.ToString());
}
return Report;
}
public virtual String GetCustomizedCacheKey(RequestContext request)
{
String key = null;
key = RequestContext.BuildCompleteCacheKey(
request,
reportName,
this.GetType(),
this.ShareDBLogonInfo);
return key;
}
}
}
Code appelant la classe : try
{
mParameterField.ParameterFieldName = "discreteVal"; // Champ de parametre
mDiscreteVal.Value = m_sParametre; // Je récupère la valeur d'un string et je le met dans la valeur discrete
mParameterField.CurrentValues.Add(mDiscreteVal);
mParameterFields.Add(mParameterField);
CachedReport cr = new CachedReport(@"C:\test\2007\CR_test.rpt", mDiscreteVal);
mCrViewer.ParameterFieldInfo = mParameterFields;
mCrViewer.ReportSource = cr;
}
catch (Exception exc)
{
MessageBox.Show(exc.Message);
}
Et voila

spike