Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

The application was developed in VS 2008, on button client click system opens a page with a crystal report containing multiple subreports.
The report is not connected to the database directly but connects via data sets which are populated on page load.
After hosting the code in server , I am getting below error;
Logon failed. Error in File C:\windows\TEMP\Reportname{F8EE4295-91EE-476B-95A7-E950D05B41FD}.rpt: Unable to connect: incorrect log on parameters.


Here is the code used.

protected void Page_Load(object sender, EventArgs e)
        {
                this.CrvSingleGTINReport.SeparatePages = true;
                Data();
                        reportDoc.Load(reportFilePath);
                        ReportdataLoad (reportDoc);
                    CrvSingleGTINReport.ShowFirstPage();
            }
            catch (Exception ex)
            {
            }
        }


  public void ReportdataLoad(ReportDocument reportDocument)
        {
            DataTable Data;

            try
            {
                if (Session["Data"] != null)// Data tables loaded previously
                {
                    Data = new DataTable();
                    Data = (DataTable)Session["Data"];
                    reportDocument.SetDataSource(Data);
                    reportDoc.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
                    CrvSingleGTINReport.ReportSource = reportDoc;                    
                }
            }
            catch (Exception ex)
            {                
            }


What I have tried:

It is working on my local machine.
Posted
Updated 9-Feb-21 12:20pm

1 solution

Since the report has subreports, you need to assign datasource for those subreports. Refer below article
Generating a Report from Multiple Data Sources in Crystal Reports[^]
 
Share this answer
 
Comments
bristii 9-Feb-21 19:31pm    
Hi,

The data sources are assigned to the subreport and it is working on the local machine and windows server with IIS 7, it is not working when hosted in IIS 10. I have also created a very basic crystal report application and hosted in IIS 10.0 and it is not working. I have two observations so far - the crystal report is not working (even though the run time crystal report engine and the dot net framework is installed) and also after the hosting system is randomly timing out - currently the session time out is set to 20.

Example:

if (!IsPostBack)
{
ReportDocument reportdocument = new ReportDocument();
reportdocument.Load(Server.MapPath("~/CrystalReport.rpt"));
UserInformation dsCustomers = new UserInformation();
using (OracleConnection con = new OracleConnection("Data Source=xxxxx.world;User Id=xxxx;Password=xxxxxxx;"))
{
con.Open();
OracleCommand cmd = new OracleCommand("select UserId, UserName,FirstName,LastName,Location from UserTable", con);
OracleDataAdapter da = new OracleDataAdapter(cmd);
da.Fill(dsCustomers, "UserInfo");
con.Close();
if (dsCustomers != null && dsCustomers.Tables["UserInfo"].Rows.Count > 0)
Label1.Text = dsCustomers.Tables["UserInfo"].Rows[0][2].ToString();
}

reportdocument.SetDataSource(dsCustomers.Tables["UserInfo"]);
CrystalReportViewer1.ReportSource = reportdocument;
}





Dataset:


<xs:schema id="UserInformation" targetnamespace="http://tempuri.org/UserInformation.xsd" xmlns:mstns="http://tempuri.org/UserInformation.xsd" xmlns="http://tempuri.org/UserInformation.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeformdefault="qualified" elementformdefault="qualified">
<xs:annotation>
<xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
<datasource defaultconnectionindex="0" functionscomponentname="QueriesTableAdapter" modifier="AutoLayout, AnsiClass, Class, Public" schemaserializationmode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<connections>
<tables>
<sources>



<xs:element name="UserInformation" msdata:isdataset="true" msdata:usecurrentlocale="true" msprop:generator_userdsname="UserInformation" msprop:generator_datasetname="UserInformation">
<xs:complextype>
<xs:choice minoccurs="0" maxoccurs="unbounded">
<xs:element name="DataTable1" msprop:generator_usertablename="DataTable1" msprop:generator_rowdeletedname="DataTable1RowDeleted" msprop:generator_tableclassname="DataTable1DataTable" msprop:generator_rowchangedname="DataTable1RowChanged" msprop:generator_rowclassname="DataTable1Row" msprop:generator_rowchangingname="DataTable1RowChanging" msprop:generator_rowevargname="DataTable1RowChangeEvent" msprop:generator_rowevhandlername="DataTable1RowChangeEventHandler" msprop:generator_tablepropname="DataTable1" msprop:generator_tablevarname="tableDataTable1" msprop:generator_rowdeletingname="DataTable1RowDeleting">
<xs:complextype>
<xs:sequence>
<xs:element name="UserId" msprop:generator_usercolumnname="UserId" msprop:generator_columnpropnameinrow="UserId" msprop:generator_columnvarnameintable="columnUserId" msprop:generator_columnpropnameintable="UserIdColumn" type="xs:string" minoccurs="0">
<xs:element name="UserName" msprop:generator_usercolumnname="UserName" msprop:generator_columnpropnameinrow="UserName" msprop:generator_columnvarnameintable="columnUserName" msprop:generator_columnpropnameintable="UserNameColumn" type="xs:string" minoccurs="0">
thatraja 10-Feb-21 0:00am    
Hope you done all things mentioned by below article. It should fix the issue.
https://www.aspsnippets.com/Articles/Crystal-Reports-13-Visual-Studio-2010-Issue-with-IIS---bobj-is-undefined-JavaScript-Error-and-Crystal-Report-Viewer-not-displaying.aspx
bristii 11-Feb-21 19:12pm    
Hi,

I have tried the steps, please note the application was developed in VS 2008 and now hosted at Win 2019 using Data Pool - dot net framework 2.0.
Adding BusinessObjects' tag was throwing an error.
Here is the snippet of the web config, when I click on the Report page worker process is crashing and the system forcing session timeout.


<configuration>
<configsections>
<sectiongroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectiongroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

<sectiongroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">








<sectiongroup name="businessObjects">
<sectiongroup name="crystalReports">









<appsettings>




<connectionstrings>
<system.web>

<httpruntime maxrequestlength="2097151" enable="true" executiontimeout="360000">
<compilation debug="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089">
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089">
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089">
<add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A">

<add assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304">
<add assembly="CrystalDecisions.Shared, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304">
<add assembly="CrystalDecisions.ReportSource, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304">
<add assembly="CrystalDecisions.CrystalReports.Engine, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304">
<add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304">
<add assembly="CrystalDecisions.Enterprise.Framework, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304">
<add assembly="CrystalDecisions.Enterprise.InfoStore, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304">






<pages>
<controls>
<add tagprefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<add tagprefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">


<httphandlers>
<remove verb="*" path="*.asmx">
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<add ver
thatraja 12-Feb-21 0:19am    
Are you getting different error message this time? Share the error message

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