Hi Leandro,
IMHO CR has a LOT to improve regarding the exception it throw, everything
is "Logon Failed" error :(.
I have done what you want and basically this is the steps/code I use.
1- I never load the report from a file, I always compile it as an embedded
resource ( the default by the way ). this avoid the need to load the report
at runtime.
2- I use this code for initialize the report, the most important thing I
believe is give it the correct info to each of the tables:
// Collection of the logon info for each of the tables of the report
TableLogOnInfos crTableLogonInfos = new TableLogOnInfos();
//Create the report object
reportDocument1 = new OpenRecords();
//This is used to contain the connection info for the tables
ConnectionInfo crConnectionInfo = new ConnectionInfo();
crConnectionInfo.ServerName = "127.0.0.1";
crConnectionInfo.DatabaseName = "CTP";
crConnectionInfo.UserID = "CTPWeb";
crConnectionInfo.Password = "CTPApp";
// Now assign it to each of the report table
foreach (CrystalDecisions.CrystalReports.Engine.Table table in
reportDocument1.Database.Tables)
{
TableLogOnInfo crTableLogonInfo = new TableLogOnInfo();
crTableLogonInfo.TableName = table.Name;
crTableLogonInfo.ConnectionInfo = crConnectionInfo;
crTableLogonInfos.Add( crTableLogonInfo);
table.ApplyLogOnInfo( crTableLogonInfo);
}
//Assign the report and the logon info collection to the viewer
CrystalReportViewer1.LogOnInfo = crTableLogonInfos;
CrystalReportViewer1.ReportSource = reportDocument1;
Merry X-Mas,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Ing. Leandro Pérez Guió" <lp****@holguin.copextel.com.cu> wrote in message
news:uH**************@TK2MSFTNGP10.phx.gbl...
hello:
I made a webform with a CrystalReportViewer. In the event page_load, i try
to fill it with a Report, some like this...
CrystalReportViewer1.ReportSource =
MapPath("localhost/quejasweb")+\\Rpt\\My.rpt;
and i receive Load report failed.
If the database is SQL server...what am i doing wrong?
I tried using dataset, direct sql tables, etc...and nothing works just
Load report failed.
How can i do?
Thanks in advanced.
Leo