p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > .NET > Other .NET > Crystal Reports
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 9th, 2003, 05:14 AM
Authorized User
Points: 61, Level: 1
Points: 61, Level: 1 Points: 61, Level: 1 Points: 61, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default I want to view a report on Webform ASP.NET/

I have a report creat with crytal report/
I want to view it on Webform ASP.NET/
Help me now//
Thanks/


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old July 10th, 2003, 02:09 AM
Friend of Wrox
Points: 3,152, Level: 23
Points: 3,152, Level: 23 Points: 3,152, Level: 23 Points: 3,152, Level: 23
Activity: 20%
Activity: 20% Activity: 20% Activity: 20%
 
Join Date: Jun 2003
Location: Tehran, Iran
Posts: 922
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via Yahoo to melvik
Default

I hope this can help.
http://msdn.microsoft.com/library/de...talreports.asp

Always:),
Hovik Melkomian.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old July 10th, 2003, 07:21 PM
Authorized User
Points: 61, Level: 1
Points: 61, Level: 1 Points: 61, Level: 1 Points: 61, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, I have already done it/
But I don't known export report to File from page N to page M/
Do you help me/
"Export to File or Export to Plug-in msword" from page to page/
Thanks

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old July 16th, 2003, 03:20 AM
Authorized User
Points: 215, Level: 4
Points: 215, Level: 4 Points: 215, Level: 4 Points: 215, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Noida, UP, India.
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Kid1981,


It's easy...First u create a Dataset and populate the dataset using a Stored Proc or any other sources and then base your report on this dataset...Then once the report is displayed in CRViewer , u can export it on the click of a print button using the code I mention below. This code exports to PDF...u can export it to any other format. Just go thru the code properly and u will understand what to do...

using CrystalDecisions.CrystalReports.Engine ;
using CrystalDecisions.Shared ;

try
            {
                string Fname;
                bool lboolExists = false ;

                ExportOptions crExportOptions = new ExportOptions();

                // populating dataset and binding to report
                dsCampSumm = PopulateDataSet();

                // binding report again
                                //CampSumm is the reportname
                oRptCampSumm = new CampSumm();
                oRptCampSumm.SetDataSource(dsCampSumm);

                //This section of code is needed to check for existence of the folder
                //where the pdf file will be temporarily stored
                //--------------------------------------------------------------------------
                Scripting.FileSystemObject lObjFSO ;
                lObjFSO = new Scripting.FileSystemObjectClass();

                lboolExists = lObjFSO.FolderExists(Server.MapPath("../../SaleSourceTemplates/" + GetSessionAgencyId()));
                // Check for the folder name equal to Agency_id if false create one
                if (lboolExists == false)
                {
                    lObjFSO.CreateFolder(Server.MapPath("../../SaleSourceTemplates/" + GetSessionAgencyId()));
                }
                //--------------------------------------------------------------------------

                Fname = Server.MapPath("../../SaleSourceTemplates/" + GetSessionAgencyId() + "/") + Session.SessionID.ToString() + ".pdf";
                DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
                CrDiskFileDestinationOptions.DiskFileName = Fname;
                crExportOptions = oRptCampSumm.ExportOptions;
                crExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
                crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
                oRptCampSumm.Export();

                // The following code writes the pdf file to the Client’s browser.
                Response.ClearContent();
                Response.ClearHeaders();
                Response.ContentType = "application/pdf";
                Response.WriteFile(Fname);
                Response.Flush();
                Response.Close();
                //delete the exported file from disk
                System.IO.File.Delete(Fname);
            }
            catch(Exception ex)
            {
                throw new Exception(ex.Message);
            }



private DsReport PopulateDataSet()
        {
            dsCampSumm = new DsReport();

            try
            {
                gstrQuery="sp_CampSumm ";

                if (Request.QueryString["CampId"]=="All") //CampId
                    gstrQuery=gstrQuery + BusinessRules.Reports.CAMPID + ",";
                else
                    gstrQuery=gstrQuery + Request.QueryString["CampId"] + ",";

                if (Request.QueryString["CampManagerId"]=="All") //CampManagerId
                    gstrQuery=gstrQuery + BusinessRules.Reports.MANAGERID + ",";
                else
                    gstrQuery=gstrQuery + Request.QueryString["CampManagerId"] + ",";

                if (Request.QueryString["StartDate"]!=null) //Start Date
                    gstrQuery=gstrQuery + "'" + Request.QueryString["StartDate"] + "'" + ",";
                else
                    gstrQuery=gstrQuery + "''" + ",";

                if (Request.QueryString["Status"]!=null) //Status
                    gstrQuery=gstrQuery + "'" + Request.QueryString["Status"] + "'" + ",";
                else
                    gstrQuery=gstrQuery + "'" + BusinessRules.Reports.STATUSBOTH + "'" + ",";

                if (Request.QueryString["Launch"]!=null) //Launched
                    gstrQuery=gstrQuery + "'" + Request.QueryString["Launch"] + "'" + ",";
                else
                    gstrQuery=gstrQuery + "'" + BusinessRules.Reports.LAUNCHBOTH + "'" + ",";

                gstrQuery=gstrQuery + GetSessionAgencyId() + ",";
                gstrQuery=gstrQuery + GetSessionBranchId();

                SqlConnection myconnection = new SqlConnection() ;
                //myconnection.ConnectionString = "server=DEBARSHI;database=SaleSource;uid=SSAdmin;p wd=admin";
                myconnection.ConnectionString = "Server=" + GetDatabaseServerName() + ";" +
                    "Database=" + GetDatabaseName() + ";" +
                    "uid=" + GetSQLUserId() + ";" +
                    "pwd=" + GetSQLPassword();
                myconnection.Open();

                SqlCommand mycommand = new SqlCommand();
                mycommand.Connection = myconnection;
                mycommand.CommandText = gstrQuery;
                mycommand.CommandType = CommandType.Text;

                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = mycommand;
                da.Fill(dsCampSumm, "CampaignSummary");
            }
            catch(Exception pEx)
            {
                throw new SaleSourceException(pEx.Message + " " + pEx.StackTrace,pEx,GetSessionUserId());
            }
            return dsCampSumm;
        }
Quote:
quote:Originally posted by kid1981
 Yes, I have already done it/
But I don't known export report to File from page N to page M/
Do you help me/
"Export to File or Export to Plug-in msword" from page to page/
Thanks

cheers,
debsoft
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old July 26th, 2003, 05:19 AM
Authorized User
Points: 61, Level: 1
Points: 61, Level: 1 Points: 61, Level: 1 Points: 61, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks all friend/
Now, I want to push parameter from "ASP.NET Form" to a report/
But I don't known it/
do you help me???
Thanks

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #6 (permalink)  
Old July 26th, 2003, 05:43 AM
Friend of Wrox
Points: 3,152, Level: 23
Points: 3,152, Level: 23 Points: 3,152, Level: 23 Points: 3,152, Level: 23
Activity: 20%
Activity: 20% Activity: 20% Activity: 20%
 
Join Date: Jun 2003
Location: Tehran, Iran
Posts: 922
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via Yahoo to melvik
Default

Hi there:
I hope this sample will help u to pass parameter to Report File.
(Use '@' if u use Stored Procedure in ur report)

  reports.vekalat crReportDocument;
  ParameterFields crParameterFields;
  ParameterField crParameterField;
  ParameterValues crParameterValues;
  ParameterDiscreteValue crParameterDiscreteValue;

  private void Page_Load(object sender, System.EventArgs e)
  {
  crReportDocument = new REPORT_NAME();

  CrystalReportViewer1.ReportSource = crReportDocument;
  crParameterFields = CrystalReportViewer1.ParameterFieldInfo;
  crParameterField = crParameterFields["@PARAMETER_NAME"];
  crParameterValues = crParameterField.CurrentValues;

  crParameterDiscreteValue = new ParameterDiscreteValue();
  crParameterDiscreteValue.Value = PARAMETER_VALUE;
  crParameterValues.Add(crParameterDiscreteValue);
  }

let me know about that.


Always:),
Hovik Melkomian.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #7 (permalink)  
Old July 26th, 2003, 05:53 AM
Authorized User
Points: 61, Level: 1
Points: 61, Level: 1 Points: 61, Level: 1 Points: 61, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

example:
I have a InputBox + a Button
and CrystalView --> view a Report/
I want to tranfer a Parameter from InputBox before "Button" Click
Do you help me???
Thanks all

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #8 (permalink)  
Old July 26th, 2003, 06:09 AM
Friend of Wrox
Points: 3,152, Level: 23
Points: 3,152, Level: 23 Points: 3,152, Level: 23 Points: 3,152, Level: 23
Activity: 20%
Activity: 20% Activity: 20% Activity: 20%
 
Join Date: Jun 2003
Location: Tehran, Iran
Posts: 922
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via Yahoo to melvik
Default

I tryed to be clear in my sample so if u want to set a parameter value :
Code:
crParameterDiscreteValue.Value = PARAMETER_VALUE;
do it like follow:
Code:
crParameterDiscreteValue.Value = textBox.Text;
let me know if u get it.

Always:),
Hovik Melkomian.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #9 (permalink)  
Old July 27th, 2003, 10:57 PM
Authorized User
Points: 61, Level: 1
Points: 61, Level: 1 Points: 61, Level: 1 Points: 61, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I don't known C#, may be you send code VB.NET for me???

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #10 (permalink)  
Old July 27th, 2003, 11:35 PM
Friend of Wrox
Points: 3,152, Level: 23
Points: 3,152, Level: 23 Points: 3,152, Level: 23 Points: 3,152, Level: 23
Activity: 20%
Activity: 20% Activity: 20% Activity: 20%
 
Join Date: Jun 2003
Location: Tehran, Iran
Posts: 922
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via Yahoo to melvik
Default

I dont know VB:D next time mention ur lang for forum.

Always, Hovik.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.Net, Access DB, and a webform? TheNinthPlayer BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 8 June 3rd, 2008 11:28 AM
Embed MsWord in asp.net webform rajatake ASP.NET 2.0 Professional 1 December 5th, 2006 11:29 AM
how to view crystal report in asp.net bhaveshsanghani BOOK: Professional Crystal Reports for VS.NET 0 April 26th, 2006 05:52 AM
Import Excel Spreadsheet into ASP.NET webform evelynlsy ASP.NET 1.1 0 April 2nd, 2005 08:44 AM
How to send SMS from asp.net webform somissac ASP.NET 1.1 0 March 24th, 2005 08:12 AM



All times are GMT -4. The time now is 06:28 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc