Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Guys I have a huge problem and really i dnt knw how to solve this please help me on this .Im working on a project these days which uses crystal reports suddenly some crystal reports wont work but when I run from the CODE the reports works nicely but when i publish my website and host it it wont work. In my website there are like 20 reports 15of them working without any problem after publishing even but 5 of them wont work after published.


C#
<pre lang="c#"><pre lang="c#"><pre lang="c#">
C#
protected void Page_Init(object sender, EventArgs e)
   {

       var ds = new DataSet();
       var rptCriteria = new ReportCriteria();

       if (Session["RptCriteria"] != null)
           rptCriteria = (ReportCriteria)Session["RptCriteria"];

       if (Session["Report"] != null)
           ds = (DataSet)Session["Report"];
       if (rptCriteria.Report == "P1")
       {
           _reportDocument.Load(Server.MapPath("~/Reports/PAYESummery.rpt"));
           _rptName = "PAYESummary-Part I";
       }
       else if (rptCriteria.Report == "P2")
       {
           _reportDocument.Load(Server.MapPath("~/Reports/PAYESummeryPart2.rpt"));
           _rptName = "PAYESummary-Part II";
       }
       else if (rptCriteria.Report == "P3")
       // T9 table
       {
           _reportDocument.Load(Server.MapPath("~/Reports/t9report.rpt"));
           _rptName = "T9 Report";

       }
       else
       {

           Label2.Text = "errorrrr";
       }

       if (ds != null && ds.Tables.Count > 0)
       {
           Label2.Text = ds.Tables[0].Rows.Count.ToString();
       }

           //-----------------------------------------------------------
       crConnectionInfo.ServerName = ConfigurationManager.AppSettings["ServerName"];
       crConnectionInfo.DatabaseName = ConfigurationManager.AppSettings["DatabaseName"];
       crConnectionInfo.UserID = ConfigurationManager.AppSettings["UserID"];
       crConnectionInfo.Password = ConfigurationManager.AppSettings["Password"];

       //-----------------------------------------------------------
       var crTableLogOnInfo = new TableLogOnInfo();
       crDatabase = _reportDocument.Database;
       crTables = crDatabase.Tables;

       foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)
       {
           crTableLogOnInfo = crTable.LogOnInfo;
           crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
           crTable.ApplyLogOnInfo(crTableLogOnInfo);
       }

           _reportDocument.SetDataSource(ds);
           _reportDocument.VerifyDatabase();
           rptViwer1.ReportSource = _reportDocument;
           rptViwer1.Zoom(75);
        //   rptViwer1.DataBind();
           rptViwer1.RefreshReport();



C# code and follwing is the .net code

XML
<table>
            <tr>
            <td>
            <asp:Label ID="Label2" runat="server" Text=""></asp:Label>

            </td>
                <td width="120px">Document Type</td>
                <td>
                    <asp:DropDownList ID="ddlDocType" Width ="145px" runat="server" Enabled ="true">
                   <asp:ListItem Value ="PDF" Text ="Adobe (PDF)"></asp:ListItem>
                   <asp:ListItem Value ="EXL" Text ="MS Excel"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:Button ID="btnDownload" runat="server" Text="Download"   Width ="80px" onclick="btnDownload_Click"
                         />
                </td>
            </tr>
        </table>





but really i dnt think there is a code issue bcoz reports are working when run from the code i put a label to find out whether there are records comes to the dataset and it really shows there are 460 records in the data set



Following screen shot is from where i run the website from the project
https://drive.google.com/a/iomworld.com/file/d/0B-4F4EZf1BJ0RHktTDFoUWhoczA/view?usp=sharing[^]


run the website after publish
https://drive.google.com/open?id=0B-4F4EZf1BJ0MTF3bWlyc3ZQWjQ&authuser=0[^]


note that the highlighted part that is the record count the dataset has
Posted
Updated 16-Jun-15 16:16pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900