locked
VS2010 and Crystal Reports - report runs, report won't run after a compile RRS feed

  • Question

  • User1835900635 posted

    Hi, hope someone can help me with this problem.

    I have a ASP.NET web application in VS2010 that collects data from a mdb file, puts it into a dataset and shows it into a gridview.  The user can export this data using Crystal Reports.

    I created the reports using the wizard.  They are stored as rpt files in my project, located into a subfolder "\reports".  When using VS to run the project the export runs fine.

    When creating an installer project (including the primary output, creating the subfolder and adding the rpt files) and installing this project on a Win2008 64 bit server, I have this strange issues:

    - the griview is filled like it should (so the dataset = ok)
    - the export (to crystal report viewer or pdf) keeps loading the page, but it won't show the report.  So, I figured it couldn't find the rpt file in the subfolder. 

    I changed the code and said it should look for the rpt file under the root.  No success. 

    However, after some tests (creating a new rpt, recompiling, ...) the report shows like it should (placed in the subfolder or under the root).  So, I only changed the name of the report in the code (to show a different report on the same location -> rpt2) - same problem.  

    After changing the code to try some other reports, all of a sudden rpt2 works fine (wich gave problems before)

    On the Win2008 server, I installed the Crystal Reports runtime files.  Somethimes the report shows correctly, so I guess these runtime files are ok.

    This code is used to show or export the report (simplified).  Maybe my approach to this is wrong, I have no idea...

    Dim sql As String = "SELECT * FROM tblInfo"
    objConnection.Open()
    Dim objCommand As OleDbCommand = New OleDbCommand(sql, objConnection)
    DataAdapter = New OleDbDataAdapter(objCommand)
    DataAdapter.Fill(adoDataSet, "info")
    objConnection.Close()
    
    Dim rapport As New ReportDocument
    rapport.Load(Server.MapPath("reports/report1.rpt"))
    rapport.SetDataSource(adoDataSet.Tables("info"))
    
    rapport.ExportToDisk(ExportFormatType.PortableDocFormat, "C:\test\test123.PDF")
    
    dim attachement As String = "attachment; filename=c:\test\test123.PDF"
    Response.ClearContent()
    Response.AddHeader("content-disposition", attachement)
    Response.ContentType = "application/PDF"
    Response.TransmitFile("c:\test\test123.PDF")
    Response.End()
    Monday, July 4, 2011 3:03 AM

Answers

  • User1835900635 posted

    Hey,

    I tried with different browsers (IE, firefox, google chrome), no luck.  However, I posted this problem on the SAP community network. -> http://forums.sdn.sap.com/thread.jspa?forumID=313&threadID=1988281

    When I enable the option "no printer" in my report everything works fine! (even if there's a default printer that supports landscape mode, ...)   But everything seems to run fine now (I installed the printer driver on the server, and now I can even disable the no printer option).  So, this must have been a printer / driver issue maybe, but I can't say exactly what.

    Thanks for the help anyway!!

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 6, 2011 3:48 AM

All replies

  • User-269404413 posted

    MMY,

    check the crystal report MSM was installed on the server.

    Monday, July 4, 2011 3:25 AM
  • User1835900635 posted

    I'v installed the runtime files using the msi file located at

    http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/20322

    since a sticky post from the sap site says there will be no msm files available http://forums.sdn.sap.com/thread.jspa?threadID=1748318&tstart=0

     

    update: I have deleted all my rpt files and created them again (simplefied version).  Seems they are running now (hoping this won't change!).  I'll change the code back and apply the correct format to the rpt's...

    Monday, July 4, 2011 3:33 AM
  • User-269404413 posted

    MMY,

    MSM is essential to run crystal report on your server, so, that i refered you. its like asp.net framework.

    definately it'll under your development machine, while create deployment application include this MSM also and then install on your server.

    Monday, July 4, 2011 5:27 AM
  • User1835900635 posted

    hi, thanks for the help.  But I can't find any MSM files for Crystal Reports under Visual Studio 2010.  Instead, I downloaded the msi runtime files, which should be used to view the reports on the server.   So this msi file should install everything like the MSM files.  Somethimes, I can view the reports on the server machine, so I guess these files are ok.

    Very strange now, I deleted my reports and created them again.  Everything worked.  I changed the format of one report and it won't load anymore.  I remove this format, and still, can't get the report to run anymore. 

    I'm looking for another server machine with IIS to check if the problem occurs there too.

     

    EDIT: hope I found the error...seems to be going ok now -> Response.End() (last line of code) seems to cause the problem, aborting the thread before the report is generated

     

    Monday, July 4, 2011 5:39 AM
  • User1196771204 posted

    hi mmy1981,

    May I know how did you host the report? Is that on a shared server? Have you made sure all the necessary Crystal Report files are setup properly on the server? 

    Tuesday, July 5, 2011 12:11 AM
  • User1835900635 posted

    Hi,

    In the web application I created a 2nd project (an installer project).  This project (the setup) contains the primary output (the aspx pages) and the separate rpt files (in the created subfolders).

    I run this setup on the server (company's intranet server running IIS).  The correct folders are created under the inetpub\wwwroot containing all the files, subfolders and rpt files.  In IIS everything seems ok too, the users have full permissions on the folders, ...

    Also, on the server, the Crystal Reports Runtime files 13_0_1 files are installed (tried them for 32bit and 64bit). 

    I'm pretty sure (as far as I know) these files are correct since I succeeded in creating, showing and exporting the reports before.  With deleting the last line of code (Response.End() ) most of the reports seem to run ok now.  Except for 2 reports, I'v created them again, no success, ...   I'll have to troubleshoot some more I guess...

    Tuesday, July 5, 2011 2:08 AM
  • User1196771204 posted

    it is good to know that you are making some progress there....

    please keep us posted of any update 

    Tuesday, July 5, 2011 2:23 AM
  • User1835900635 posted

    update!!!  Seems the main problem is when I convert the report to landscape mode.  Then, the report won't run anymore (or it keeps loading in a blank screen).  When I convert it back into portrait mode, the problem remains (so the report seems corrupt).  I delete the report, create the same report (in portrait) and everything works fine till I switch it back to landscape mode.

    Seems there are some topics on google with the same description, hope to find a sollution there.  Will keep this thread informed...

    Tuesday, July 5, 2011 6:23 AM
  • User1196771204 posted

    hi mmy1981,

    Have you tried it from several different browser? I would suggest you to try this out as some browsers may give you problems in display. 

    Tuesday, July 5, 2011 10:47 PM
  • User1835900635 posted

    Hey,

    I tried with different browsers (IE, firefox, google chrome), no luck.  However, I posted this problem on the SAP community network. -> http://forums.sdn.sap.com/thread.jspa?forumID=313&threadID=1988281

    When I enable the option "no printer" in my report everything works fine! (even if there's a default printer that supports landscape mode, ...)   But everything seems to run fine now (I installed the printer driver on the server, and now I can even disable the no printer option).  So, this must have been a printer / driver issue maybe, but I can't say exactly what.

    Thanks for the help anyway!!

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 6, 2011 3:48 AM
  • User1196771204 posted

    hi mmy1981,

    I am glad to understand that you can finally resolve the issue 

    Wednesday, July 6, 2011 11:11 PM