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 April 17th, 2006, 12:08 AM
Registered User
 
Join Date: Apr 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Programmatically Alter Values in Select Expert

Hi All,

I have this program that can let the user print the crystal report from my
asp.net application. It works find with report without need to alter query
value.

but some reports need to be compilie based on different values (specify in
SELECT EXPERT) each time it is run. How do i write my codes to do that?

Many thanks in advance for any help

below is my code for the simple export to PDF file:

----------------------------------------------------------------------------
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.Shared
Imports System.IO

Public Class ReportPrinter
    Inherits System.Web.UI.Page

    Public crReportDocument As ReportDocument
    Public crExportOptions As ExportOptions
    Public crDiskFileDestinationOptions As DiskFileDestinationOptions
    Public Fname As String

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    '<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

    'End Sub

    Public Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        ' InitializeComponent()

        crReportDocument = New ReportDocument()


crReportDocument.Load("C:\Inetpub\wwwroot\CrystalW eb\CrystalReport\QtyOnHand
QtyAvailable.rpt")

        Fname = "C:\Inetpub\wwwroot\CrystalWeb\Download\" &
Session.SessionID.ToString & ".pdf"

        crDiskFileDestinationOptions = New DiskFileDestinationOptions()
        crDiskFileDestinationOptions.DiskFileName = Fname

        crExportOptions = crReportDocument.ExportOptions
        With crExportOptions
            .DestinationOptions = crDiskFileDestinationOptions
            .ExportDestinationType = ExportDestinationType.DiskFile
            .ExportFormatType = ExportFormatType.PortableDocFormat
        End With

        Try

            crReportDocument.Export()

            Response.ClearContent()
            Response.ClearHeaders()
            Response.ContentType = "application/pdf"
            Response.WriteFile(Fname)
            Response.Flush()
            Response.Close()

            System.IO.File.Delete(Fname)

        Catch err As Exception
            Response.Write("<BR><BR>")
            Response.Write(err.Message.ToString)
            Response.Write("<BR><BR>")
            Response.Write(err.StackTrace.ToString)
        End Try
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
    End Sub

End Class


Bernard Goh
IT Administrator





Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the statement to select limited values? Mangore SQL Language 1 December 1st, 2008 02:42 AM
Programmatically select a treeview node and expand simsen ASP.NET 2.0 Professional 0 June 23rd, 2008 01:57 AM
INSERT INTO with parameterized values and SELECT elygp SQL Server 2000 1 September 6th, 2007 04:48 AM
How to loop for Select Values rohit_ghosh Excel VBA 3 May 8th, 2007 03:29 PM
Select Expert Not Working bclick Crystal Reports 0 October 3rd, 2006 02:14 PM





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