Print Page | Close Window

Report display error

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Data Connectivity
Forum Discription: How to connect to data sources and export reports
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=12131
Printed Date: 28 Apr 2024 at 9:18am


Topic: Report display error
Posted By: phantom_244
Subject: Report display error
Date Posted: 23 Jan 2011 at 7:21am

i have a main report that contains some sub report. Each sub report will load data from database via stored procedures and then these sub reports  was added to Main report. I run this report on local sucessfully, but when i deploy on server, it shows error Database logon fail. In my code i have set database connect to database (connection string get from web.config that the same with connection of server). I have a question about this error? Why it run successfully on local, when deploy to server it fail? Does i need to add some lines of code to my class? these is my code:

 ReportDocument rp = new ReportDocument();

//Load report file
rp.Load(ReportHelper.GetReportPath("Report path"));

//Set up connection
rp.SetDatabaseLogon("uid", "pwd", "server","database");

//Add data to Subreport:
rp.OpenSubreport("SubReportName_1").SetDataSource(GetReport_1().Tables[0]);

rp.OpenSubreport("SubReportName_2").SetDataSource(GetReport_2().Tables[0]);

//Bind to report viewer
ReportView_1.ReportSource = rp;
ReportView_1.DataBind();
Please help me! it's urgent :(. Thanks all so much!



Print Page | Close Window