Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
Password Reminder
Register
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 Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 9th, 2003, 04:14 AM
Authorized User
 
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/


Reply With Quote
  #2 (permalink)  
Old July 10th, 2003, 01:09 AM
Friend of Wrox
Points: 3,558, Level: 25
Points: 3,558, Level: 25 Points: 3,558, Level: 25 Points: 3,558, Level: 25
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: California, USA
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

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

Always:),
Hovik Melkomian.
Reply With Quote
  #3 (permalink)  
Old July 10th, 2003, 06:21 PM
Authorized User
 
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

Reply With Quote
  #4 (permalink)  
Old July 16th, 2003, 02:20 AM
Authorized User
 
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
Reply With Quote
  #5 (permalink)  
Old July 26th, 2003, 04:19 AM
Authorized User
 
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

Reply With Quote
  #6 (permalink)  
Old July 26th, 2003, 04:43 AM
Friend of Wrox
Points: 3,558, Level: 25
Points: 3,558, Level: 25 Points: 3,558, Level: 25 Points: 3,558, Level: 25
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: California, USA
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
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.
Reply With Quote
  #7 (permalink)  
Old July 26th, 2003, 04:53 AM
Authorized User
 
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

Reply With Quote
  #8 (permalink)  
Old July 26th, 2003, 05:09 AM
Friend of Wrox
Points: 3,558, Level: 25
Points: 3,558, Level: 25 Points: 3,558, Level: 25 Points: 3,558, Level: 25
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: California, USA
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
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.
Reply With Quote
  #9 (permalink)  
Old July 27th, 2003, 09:57 PM
Authorized User
 
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???

Reply With Quote
  #10 (permalink)  
Old July 27th, 2003, 10:35 PM
Friend of Wrox
Points: 3,558, Level: 25
Points: 3,558, Level: 25 Points: 3,558, Level: 25 Points: 3,558, Level: 25
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: California, USA
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

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

Always, Hovik.
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to view crystal report in asp.net bhaveshsanghani BOOK: Professional Crystal Reports for VS.NET 1 October 26th, 2014 12:10 AM
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 10:28 AM
Embed MsWord in asp.net webform rajatake ASP.NET 2.0 Professional 1 December 5th, 2006 11:29 AM



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


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.