Click to See Complete Forum and Search --> : security problems when try to acces crystal reports in sharepoint services


repalley
August 23rd, 2004, 12:07 PM
Hello,

does any one know how to use crystal reports in custom web part
i tried to use but its throughing security exception and i could'nt find much help on the net...

code:

using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

protected override void CreateChildControls()
{
try
{
ReportDocument crpt = new ReportDocument();
CrystalDecisions.Shared.TableLogOnInfo myLogin = new
CrystalDecisions.Shared.TableLogOnInfo();
crpt.Load("C:/Documents and Settings/DEVELOPMENT/My
Documents/VisualStudioProjects/LaunchReport/CrystalReport1.rpt");

foreach(CrystalDecisions.CrystalReports.Engine.Table mytable in
crpt.Database.Tables)
{
myLogin = mytable.LogOnInfo;
myLogin.ConnectionInfo.ServerName = "ServerName";
myLogin.ConnectionInfo.DatabaseName = "DataBaseName";
myLogin.ConnectionInfo.Password = "Password";
myLogin.ConnectionInfo.UserID = "UseName";
mytable.ApplyLogOnInfo(myLogin);
}
CrystalReportViewer1.ReportSource = crpt;
CrystalReportViewer1.DataBind();
Controls.Add(CrystalReportViewer1);
}
catch(Exception e)
{
throw(e);
}
}
Thanks

MRutledge
August 26th, 2004, 07:29 PM
Can you post the error message that it is throwing so we might be able to determine if it is a user / process permission issue.