on 08-27-2013 10:41 PM
Hello,
I have a VS2010 MVC project. Created Crystal Reports and programatically used the code as below..
This works fine when running on my local machine..
ReportClass rptH = new ReportClass();
TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
Tables CrTables;
fileName = Path.Combine(crystalReportPath, "Test.rpt");
rptH.FileName = fileName;
rptH.Load();
rptH.Refresh();
crConnectionInfo = ReportServ.GetCrystalReportConnection();
CrTables = rptH.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in CrTables)
{
crtableLogoninfo = crTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crtableLogoninfo);
}
rptH.SetParameterValue("@p_year", pYear);
Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
return File(stream, "application/pdf");
Set the Test.rpt file Build Action to "Content", created a SetUp project and deployed the MSI package onto the server.
The server is a Win2003 server, where "CRRuntime_32bit_13_0_6.msi" package has been installed.
All the stored procedures and database tables are set up correctly.
On the click of the button the above code runs and displays a blank page..
Have been scouring through the forums but not able to find a solution.
Any help is very much appreciated..
Thanks
Please
Since you are getting a blank page, I'd say that the logon is successful. But there is either no data found, or the particular user has no rights to see that data.
So, try the following;
logon as someone else (Admin as a test may be best)
or
Download CR 2011 eval from here:
http://www.sap.com/solutions/sapbusinessobjects/sme/freetrials/index.epx
then open the report in the CR 2011 designer and log on with the same credentials as you use in the app. Does that work?
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow us on Twitter
Got Enhancement ideas? Try the SAP Idea Place
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I installed CR 2011 amd opened the Crystal reports.
Then set up the database connection for that server..
The error is as below,
Failed to retrieve data from database
Details : ADO Error Code: 0x80004005
Source: Microsoft OLE DB Provider for SQL Server
Description: Could not locate entry in sysdatabases for database "Test_NEW". No entry found with that name. Make sure the name is entered correctly.
SQL State: 08004
Native Error: 911[ Database vendor code : 911]
"Test_NEW" was the database name on my local machine. When the database was set up on the server it was named as "Test". I can go ahead and update the stored procedure but I did not want to before checking with you. Is this something that I should do on the server, update the stored procedure using database expert.
Please do let me know.
Thanks for your help.
Ok. So the report does not even work in the designer...
Now, presumably it work on your dev system, so there is an environmental difference between deployed system and dev system.
Native Error: 911[ Database vendor code : 911] is coming straight from the database client, so check your database documentation.
Compare the clients on the dev and deployed systems.
Keep in mind that MS SQL Server 2008 does not work with the MDAC version of the Native drivers, you must install the MS SQL Server Client. You'll see the driver name is "MS SQL Server Native client 10". This is the one you need to use. Alternatively, use ODBC, it seems to resolve all issues, but the client must be installed.
- Ludek
Sorry I did not quite get that... This is my understanding, please correct me if I am wrong
I have SQL Server 2005 on my server and local machine.
Are you saying if the database names or DB users are different in local and server, the
crystal report will not be able to change its database settings. The DB configuration in
my scenario is provided programatically.
In this case the Crystal report developed on my local machine had "Test_New" as their database
and the database on the server is named "Test". Same SP names..
Thanks
I have changed the data source to SQL Native Client and when I open the reports from the Web Application its still shows Blank Page.. on the server.
I can open the reports in the CR 2011 and then have to change the DB server details to point to the database on the server, at which point the report works fine as a standalone report.
Just don't know what else to do to make it work with the web application..
I can open the reports in the CR 2011 and then have to change the DB server details to point to the database on the server
Whatever the above changes are done in the designer, you have to do in code. You may want to save the working report (once you've changed the DB server details) as temp.rpt. Then use the DB logon code writing utility attached to this KBA to get the correct code.
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow us on Twitter
Got Enhancement ideas? Try the SAP Idea Place
I did exactly like you mentioned.. The code was created based on the report on server
Then I changed the username / password, report path and the parameter value..
And added these lines of code
ReportDocument rDoc = ChangeConnectionInfo();
Stream stream = rDoc.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
return File(stream, "application/pdf");
Built the project and deployed on server.
Unfortunately still getting a blank page..
Checked the designer on the server, the report is displaying correctly when the correct server details, username / password
are given..
Thanks
Amruth
As a test, rather than streaming the file, I'd like you to add a CR viewer to a form and send the report to the viewer
CrystalReportsViewer1.ReportSource = your report
Do you see the data in the viewer? If not, export the report from the viewer to report file format and then try to view it in the CR designer. What happens now?
- Ludek
Just the runtime from the MSI.
I'd suggest creating a phone case as I don't think we're moving this along. Phone cases can be created here:
http://store.businessobjects.com/store/bobjamer/en_US/pd/productID.98078100
- Ludek
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.