cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Reports ASP.Net Not Move on Next Page

Former Member
0 Kudos

Dear All,

I am using Visual Studio 2010 and its built-in Crystal Reports in ASP .Net.

On Crystal Report I have more then 1 pages and I am on first page when I click on "Go to Next Page", progress bar start and continuous start not move on the next page but in Page Navigation text box shows 1 of 2. My all code is in Page_Init() already.

Please anyone can tell me.... How can I get rid of this problem??????

Thanks & Regards;

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

See if placing the report object in session will help. Also, make sure you're on SP 6.

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter

Got Enhancement ideas? Try the SAP Idea Place

Share Your Knowledge in SCN Topic Spaces

Former Member
0 Kudos

Thanks for quick response,

Let me tell you one thing that I am using CrystalDecisions.CrystalReports.Engine.ReportClass instead of CrystalDecisions.CrystalReports.Engine.ReportDocument

I have already done; placing the report object in session but didn't get the required result. in Page Navigation text box shows 2 of 2 but 2nd page didn't display.

Thanks & Regards;

former_member183750
Active Contributor
0 Kudos

If you export to PDF or print the report, do you get two pages?

What do you get if you export to rpt file format?

- Ludek

Former Member
0 Kudos

Yes... I have 4 pages of my report and when I Export in pdf or in other format, I get all pages but move to next page not working.. I have also re-installed the SP6, Below is code which I am using..

        protected void Page_Init(object sender, EventArgs e)

        {

            SqlConnection objSqlCon = null;

            SqlCommand objSqlCmd = null;

            SqlDataAdapter objSqlAdap = null;

            try

            {

                objSqlCon = new SqlConnection(strConnectionString);

                objSqlCmd = new SqlCommand();

                objSqlCmd.CommandType = CommandType.StoredProcedure;

                objSqlCmd.CommandText = "procGetDataForReport";

                objSqlCmd.CommandTimeout = 0;

                objSqlCmd.Connection = objSqlCon;

 

                objSqlCmd.Parameters.AddWithValue("@Param_1", "Value1");

                objSqlCmd.Parameters.AddWithValue("@Param_2", "Value2");

                objSqlCmd.Parameters.AddWithValue("@Param_N", "Value3");

 

                objSqlAdap = new SqlDataAdapter(objSqlCmd);

                DataSet dsReport = new DataSet();

                objSqlAdap.Fill(dsReport);

                dsSubReport = GetCrSubReportData(ref objSqlCmd, ref objSqlAdap, dsSubReport);

                object rptCrystalReport = SH.Reports.ReportInfo.GetReport("SH.Reports.Tracking.rptFuelAnalysiss"); // Get Report Very well

                objRRpt = (ReportClass)rptCrystalReport;

               

                ParameterFields paramFields = new ParameterFields();

                ParameterField paramField;

                ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();

                               

                paramField = new ParameterField();

                paramField.Name = "strPrintedBy";

                paramDiscreteValue = new ParameterDiscreteValue();

                paramDiscreteValue.Value = "Printed By Name";

                paramField.CurrentValues.Add(paramDiscreteValue);

                paramFields.Add(paramField);

 

                paramField = new ParameterField();

                paramField.Name = "strLogedOnLocationName";

                paramDiscreteValue = new ParameterDiscreteValue();

                paramDiscreteValue.Value = "LogedOn Location Name";

                paramField.CurrentValues.Add(paramDiscreteValue);

                paramFields.Add(paramField);

                              

                paramField = new ParameterField();

                paramField.Name = "strCriteria";

                paramDiscreteValue = new ParameterDiscreteValue();

                paramDiscreteValue.Value = "No Criteria";

                paramField.CurrentValues.Add(paramDiscreteValue);

                paramFields.Add(paramField);

 

                paramField = new ParameterField();

                paramField.Name = "strReportCaption";

                paramDiscreteValue = new ParameterDiscreteValue();

                paramDiscreteValue.Value = "Report Caption";

                paramField.CurrentValues.Add(paramDiscreteValue);

                paramFields.Add(paramField);

                 crRptViewer.ParameterFieldInfo = paramFields;

 

                objRRpt.SetDataSource(dsReport);

                SetCrSubReprtDataSource(ref objRRpt, ref dsSubReport);

 

                TableLogOnInfo objTblLogOnInfoForRpt = new TableLogOnInfo();

 

                for (Int32 intCntr = 0; intCntr < objRRpt.Database.Tables.Count; intCntr++)

                {

                    objTblLogOnInfoForRpt.ConnectionInfo.ServerName = objSqlCon.DataSource.ToString().Trim();

                    objTblLogOnInfoForRpt.ConnectionInfo.DatabaseName = objSqlCon.Database.ToString().Trim();

                    objTblLogOnInfoForRpt.ConnectionInfo.UserID = "sa";

                    objTblLogOnInfoForRpt.ConnectionInfo.Password = "Password";

                    objTblLogOnInfoForRpt.ConnectionInfo.IntegratedSecurity = false;

                    objRRpt.Database.Tables[intCntr].ApplyLogOnInfo(objTblLogOnInfoForRpt);

                    objRRpt.Database.Tables[intCntr].Location = objTblLogOnInfoForRpt.ConnectionInfo.DatabaseName + ".dbo." + objRRpt.Database.Tables[intCntr].Location.Substring(objRRpt.Database.Tables[intCntr].Location.LastIndexOf(".") + 1);

                }

                objRRpt.SetDatabaseLogon(objTblLogOnInfoForRpt.ConnectionInfo.UserID, objTblLogOnInfoForRpt.ConnectionInfo.Password, objTblLogOnInfoForRpt.ConnectionInfo.ServerName, objTblLogOnInfoForRpt.ConnectionInfo.DatabaseName);

                crRptViewer.ReportSource = objRRpt;

            }

            catch (Exception Ex)

            {

                throw Ex;

            }

            finally

            {

                if (objSqlCon != null)

                {

                    objSqlCon.Close();

                    objSqlCon.Dispose();

                }

                if (objSqlAdap != null)

                {

                    objSqlAdap.Dispose();

                    objSqlAdap = null;

                }

                if (objSqlCmd != null)

                {

                    objSqlCmd.Dispose();

                    objSqlCmd = null;

                }

            }

        }

former_member183750
Active Contributor
0 Kudos

Confusion:

You pass a .NET Dataset to the report, then you log the report on to a database. So, what do you actually want:

1) Data from the database?

2) Data from the dataset?

- Ludek

Former Member
0 Kudos

I get data from Database and fill .Net dataset and that dataset pass to the report for display. It's showing accurate on report, export accurately but why not move/show next page

I am really in trouble..... plz tell me any other alternative if there is any mistake..

Thanks & Regards

-Imran

former_member183750
Active Contributor
0 Kudos

So, if you are passing a dataset to the report, why also log the report on to the database? Do, one or the other, not both.

- Ludek

Former Member
0 Kudos

Dear Ludek,

you mean to say I should paas the dataset to the report not LogOnInfo and vise versa, but LogOnInfo is just user name and password.. It can create the page navigation problem...?

Thanks & Regards

-Imran

former_member183750
Active Contributor
0 Kudos

Not, sure, but start with one or the other as using both will create other problems for sure...

- Ludek

Former Member
0 Kudos

I have commented the code for LogOnInfo and after that my report is not showing the data even, I have attached an Image of error (Datbase Logon Failed)

Please share some code or link, load report with ReportClass to get rid of this problem, I am really in trouble due to this...

Thanks & Regards

-- Imran

former_member183750
Active Contributor
0 Kudos

Here is what I want you to do - as a test:

1) Backup the report

2) Delete the subreport

3) The only code I want in your project as far as CR is concerned (e.g., no parameter code, no nothing):

Dim objRRpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument()

objRRpt.Load("C:\TESTS\font.rpt")

objRRpt.SetDataSource(dsReport);

CrystalReportViewer1.ReportSource = crReportDocument

The behavior should be: the viewer coms on the screen. parameter prompt screen appears. You enter the params. Report should show up in the viewer with no errors.

Does that work?

 

- Ludek

Former Member
0 Kudos

Thanks Ludek, Its work as you described and

My problem has been resolved, problem was occurring due to report parameters, On my report there were many parameters and 2 of them are @dtFrom and @dtTo and the values for these parameters going which creating problem

e.g;

@dtFrom = {7/25/2013 12:00:00 AM}

@dtTo = {7/25/2013 12:00:00 AM}

so I changed the format like

@dtFrom = objController.dtFrom.Date.ToString("yyyy-MM-dd")

@dtTo = objController.dtTo.Date.ToString("yyyy-MM-dd")

and It Works....... Cheers........

Thanks a lot for your coperation...

-- Imran


former_member183750
Active Contributor
0 Kudos

Oh wow. Tough one to figure out, but I'm glad it is finally working

Happy coding,

- Ludek

Answers (1)

Answers (1)

0 Kudos

I have run into a similar problem with SP6. 

I have an ASP.NET project in Visual Studio 2012.

If the report has more than 2 pages, the viewer will move to page 2 using the Next Page button, but will not move past page 2 using the Next Page button.  If you use the Go to Last Page button it will go to the last page, but then if you click the Previous Page you go back to the first page.

I uninstalled the SP6 (32-bit runtime) and re-installed SP5 and everything is working again.  I have tested this on Windows 8, Windows Server 2008 (32-bit) and Windows Server 2008 R2 (64-bit) and it is the same on all 3.

Has anyone else had this problem?

Thanks

Former Member
0 Kudos

Hi, I have same problem after install SP6. I'm using Visual Studio 2010, Windows Server 2008R2.

Data load to dataset and then show in report. When I rollback to SP5, it's work fine! Is it a bug in SP6?

former_member183750
Active Contributor
0 Kudos

Serge, pls create a new Discussion. Provide code used and reference this Discussion also.

- Ludek