Crystal Report Not displaying data from database its displaying designs only
Development Environment :Visual Studio 2005
I have Crystal report project working in Windows Application (winforms) and
it is working fine. Now i have got the dll of this Crystal report
project and i want to implement is Web Application. For that what
i done is I created object of particular RPT file and set the
connection and parameter values required.
My issues is I am getting a report with Design but Data is not
populating in the report. There is no Error in the Report while
running in Web.
This report is directly connecting to View. some report using
command also.
This crystal report project is developed in some other
development center and i can able to change database path to my
local server and it shows database is uptodate. But if i go to
the "Main Report Preview" of rpt file there also i am getting
blank report with designs.
I also tried in this report by going to Database Expert and
removed existing view/Command selected (That will remove entire
droped design data values from the report) and added the same
View/Command. After save and drop the fields in the requied
location i am getting data in the "Main Report Preview".
How can i do this with out removing existing View/Command? If i
need to remove this and add again i need a do lot of work for
redesign.
I am adding my current code below
Check.Reports.tcAverage rpt = new Check.Reports.tcAverage();
rpt.SetParameterValue("dateFrom","1/1/2006");
rpt.SetParameterValue("dateTo","1/1/2008");
rpt.SetParameterValue("locationId","7538167A-0835-4EE2-B1F3-B7E33
2C6850C");
rpt.SetParameterValue("unitDistanceConversionFactor","1");
rpt.SetParameterValue("unitDistanceName","");
rpt.SetParameterValue("userName","rku");
CrystalDecisions.Shared.ConnectionInfo connection = new
CrystalDecisions.Shared.ConnectionInfo ();
connection.DatabaseName = "Check1";
connection.Password = "ent";
connection.UserID = "enter";
connection.ServerName = "MAT_1";
foreach (CrystalDecisions.CrystalReports.Engine.Table
table in rpt.Database.Tables)
{
AssignTableConnection(table, connection );
}
foreach (CrystalDecisions.CrystalReports.Engine.Section
section in rpt.ReportDefinition.Sections)
{
// In each section we need to loop through all the
reporting objects
foreach
(CrystalDecisions.CrystalReports.Engine.ReportObject reportObject
in section.ReportObjects)
{
if (reportObject.Kind ==
ReportObjectKind.SubreportObject)
{
SubreportObject subReport =
(SubreportObject)reportObject;
ReportDocument subDocument =
subReport.OpenSubreport(subReport.SubreportName);
foreach
(CrystalDecisions.CrystalReports.Engine.Table table in
subDocument.Database.Tables)
{
// Cache the logon info block
TableLogOnInfo logOnInfo =
table.LogOnInfo;
// Set the connection
logOnInfo.ConnectionInfo = connection;
// Apply the connection to the table!
table.ApplyLogOnInfo(logOnInfo);
}
}
}
}
CrystalReportViewer1.ReportSource = rpt;
Thanks & Regards

