Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
| 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 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
  #1 (permalink)  
Old August 13th, 2004, 01:55 AM
Registered User
 
Join Date: Aug 2004
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default passing parameter to crystal report.net

hi,

   i have problem in passing parameter to the report.
i have added an existing report to my project which accepts parameter.
when i run this aspx page though i get the specified report but, i able to get desired output. I mean report get dispalyed only in the perivious saved format only no change even after passing the parameter.


plz help me out and tell me how to pass parameter to the crystal report through asp.net form


plz help me!
waiting desperately for the reply.

thanks in advance.

  #2 (permalink)  
Old August 17th, 2004, 07:34 AM
rsk rsk is offline
Registered User
 
Join Date: Aug 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi

I use dataset to do this:
        'open sql con
        strQuery = strQuery & strWhere 'setup the query with constratints
        sqlDA.SelectCommand.CommandText = strQuery
        Dim sqlDS As New DataSet
        sqlDA.Fill(sqlDS)
        Me.cvReport.Visible = True
        newRpt.SetDataSource(sqlDS.Tables(0))
        cvReport.ReportSource = newRpt
        sqlCon.Close()

hope it helps.

  #3 (permalink)  
Old August 19th, 2004, 02:04 AM
Registered User
 
Join Date: Aug 2004
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,

Thank u very much for ur timely help.

well, i tried out other method which worked fine.
here is the code...........

Dim cityvalue As String
        cityvalue = Request.QueryString("city")
        hidcity.Value = cityvalue


        ' Binding by report object.
        'CRobj is a report object either u can pass the path or pass the class
        'testorganization_para() is the automatically generated class of report.

        Dim CRobj As New ReportDocument()
        Dim CRdiscretevalue As New CrystalDecisions.Shared.ParameterDiscreteValue()
        Dim CRParameterFieldDefinitions As ParameterFieldDefinitions
        Dim CRParameterFieldLocation As ParameterFieldDefinition
        Dim CRparametervalues As New CrystalDecisions.Shared.ParameterValues()

        ' Get report parameter's collection

        CRobj = New testorganization_para()
        faccrystalreport.ReportSource = CRobj ' faccrystalreport is a crystalreportviewer
        CRParameterFieldDefinitions = CRobj.DataDefinition.ParameterFields
        CRParameterFieldLocation = CRParameterFieldDefinitions.Item("organization city")
        CRparametervalues = CRParameterFieldLocation.CurrentValues

        Dim CRParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue()
        CRParameterDiscreteValue.Value = cityvalue
        CRparametervalues.Add(CRParameterDiscreteValue)
        CRParameterFieldLocation.ApplyCurrentValues(CRpara metervalues)
        '
        ' Set the Crytal Report Viewer control's source to the report document.
        '

        faccrystalreport.ReportSource = CRobj

        'connection string and table information declaration

        Dim tablelongoninfo As New CrystalDecisions.Shared.TableLogOnInfo()
        Dim con As New CrystalDecisions.Shared.ConnectionInfo()

        Dim CRdatabase As Database
        Dim CRtable As Tables
        Dim cretable As Table

        con.ServerName = ""
        con.DatabaseName = ""
        con.UserID = "sa"
        con.Password = ""
        CRdatabase = CRobj.Database
        CRtable = CRdatabase.Tables

        For Each cretable In CRtable

            tablelongoninfo = cretable.LogOnInfo
            tablelongoninfo.ConnectionInfo = con
            cretable.ApplyLogOnInfo(tablelongoninfo)

        Next

        faccrystalreport.ReportSource = CRobj
        faccrystalreport.DisplayToolbar = False
'---------------------------------------------------------------------

This code is working fine.

can any one plz tell me what i have to do to pass more than one parameter(20r 4 parameters).

thank u very much.





Similar Threads
Thread Thread Starter Forum Replies Last Post
crystal report passing multiple parameter noppanit C# 0 March 20th, 2007 12:32 PM
Passing runtime parameter to Crystal Report renishl Crystal Reports 1 May 30th, 2006 12:38 AM
passing parameter values to the crystal report connect2sandep Crystal Reports 0 December 20th, 2005 06:27 AM
passing parameter from asp.net to crystal report diyagp Crystal Reports 0 October 26th, 2004 05:29 AM
Crystal report, passing parameter suni_kutty Crystal Reports 2 October 7th, 2004 03:13 AM





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