Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
|
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 25th, 2005, 12:26 PM
Registered User
 
Join Date: May 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Display data in CrystalReportViewer WebApplication

frmMain.cs:
private void btnMasterCopy_Click(object sender, System.EventArgs e)
          {
               PrintReport( enmCopyType.Master );

          }

private void PrintReport(enmCopyType copyType)
          {
          int poId;
          string poNum;
          poNum = txtPONumber.Text.Trim().ToString();
          DataSet ds = GetPOID(poNum);
          int x = ds.Tables[0].Rows.Count;
          poId = Convert.ToInt32(ds.Tables[0].Rows[0]["POID"].ToString());
          string RoleID = clsResources.DefaultRoleID;
          Session["poId"]=poId;
          Session["poNum"]=poNum;
          Session["copyType"]=copyType;
          Session["RoleID"]=RoleID;
          Response.Redirect("frmReport.aspx");
          }
     }


frmReport.cs::

private void Page_Load(object sender, System.EventArgs e)
          {
               long poId = Convert.ToInt64(Session["poId"]);
               string poNum = Session["poNum"].ToString();
               enmCopyType copyType = (enmCopyType)Session["copyType"];
               string RoleID = Session["RoleID"].ToString();

               docReport( poId, copyType, "PO #" + poNum,RoleID);
          }

public void docReport(long plngPOID, enmCopyType pType, string poNumber,string RoleID)
          {

                    ReportDocument rpt = new ReportDocument();
                    rpt.Load(Server.MapPath("PO.rpt"));
                    string userName = "sa";
                    string password = "system";
                    string databaseName = "POS_DEV1";
                    string serverName = "99LADA1";
                    ParameterFields allFields = new ParameterFields ();
                    ParameterField poIDfield = new ParameterField ();
                    ParameterDiscreteValue poIDfieldValue = new ParameterDiscreteValue();
                    ParameterField copyTypeField = new ParameterField ();
                    ParameterDiscreteValue copyTypeValue = new ParameterDiscreteValue();
                    ParameterField roleIdField = new ParameterField ();
                    ParameterDiscreteValue roleIdValue = new ParameterDiscreteValue();

                    poIDfield.ParameterFieldName = "POID";
                    poIDfieldValue.Value = plngPOID;
                    poIDfield.CurrentValues.Add( poIDfieldValue );
                    allFields.Add( poIDfield );

                    copyTypeField.ParameterFieldName = "CopyType";
                    copyTypeValue.Value = (int) pType;
                    copyTypeField.CurrentValues.Add( copyTypeValue );
                    allFields.Add( copyTypeField );

                    roleIdField.ParameterFieldName = "RoleId";
                    roleIdValue.Value = RoleID;
                    roleIdField.CurrentValues.Add( roleIdValue );
                    allFields.Add( roleIdField );

                    CrystalReportViewer CrystalReportWebFormViewer2 = new CrystalReportViewer();
                    CrystalReportWebFormViewer2.ParameterFieldInfo = allFields;
                    rpt.SetDatabaseLogon(userName, password, serverName, databaseName);

                    CrystalReportWebFormViewer2.ReportSource = rpt;
                    CrystalReportWebFormViewer2.DataBind();
                    CrystalReportWebFormViewer2.Visible = true;
               }

These are my 2 classes.When debugging i am not getting any Exception.But Data was not loading or displayed in CrystalReportViewer.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Error.. BUGBase Webapplication srinuRocks BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 February 7th, 2007 03:21 PM
WebApplication ajaidass ADO.NET 0 January 20th, 2007 03:22 PM
ASP.net WebApplication Error nidhinasthra ASP.NET 1.x and 2.0 Application Design 1 August 10th, 2005 06:12 AM
Error in WebApplication nidhinasthra ASP.NET 2.0 Basics 1 August 10th, 2005 06:12 AM
Help me :Problem deploying Webapplication lavanyarl VS.NET 2002/2003 2 November 9th, 2004 05:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.