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 May 29th, 2006, 09:10 AM
Registered User
 
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to renishl Send a message via Yahoo to renishl
Default Passing runtime parameter to Crystal Report

hello,

In my application i am using vb .net 2003 and oracle 10g database and crystal reports, in built in vb.net.
in my oracle 10g database i have one field "Rep_no" in one table. now my datbase is ready, now i want only that report which report no i entered in one textbox, i am passing that textbox's value as a parameter. my code is as below.... please guide me what i have to do? its not working properly.

Dim rptDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocum ent
Dim strReportName As String
Public Shared strFrom As String
Public Shared strTo As String

Dim crParFieldDefinitions As ParameterFieldDefinitions
Dim crParFieldDefinition As ParameterFieldDefinition

Dim crParValues As New ParameterValues
Dim crParDiscreteValue As New ParameterDiscreteValue

-----------on load event of frmpreview---------

rptDocument.Load(strReportPath)
rptDocument.SetDataSource("select * from calibration")

crParFieldDefinitions = rptDocument.DataDefinition.ParameterFields
crParFieldDefinition = crParFieldDefinitions.Item("REP_NO")
crParValues = crParFieldDefinition.CurrentValues
crParDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
crParDiscreteValue.Value = strFrom
crParValues.Add(crParDiscreteValue)
crParFieldDefinition.ApplyCurrentValues(crParValue s)
CrystalReportViewer2.ReportSource = rptDocument
-------------

I am getting error in crParFieldDefinition = crParFieldDefinitions.Item("REP_NO") ... so please guide me, "REP_NO" is my field name my database, what i have to pass in arguement.I can see all reports when i am clicking on report button in my application but I want to see only specifice report from 1 to 10 reports in my database.

Please guide me as soon as possible
Regards,
Renish

 
Old May 30th, 2006, 12:38 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello

rptDocument.SetDataSource("select * from calibration where REP_NO = ?")

If only REP_NO is the field on the table.

OR ELSE

rd.SetParameterValue("@UserType", sUserType);

@UserType -> is the parameter of the procedure
sUserType -> is the variable which will be passed to the SP.
rd -> ReportDocument object.

Its always better to create SP with params and pass params at
the run time and get the data to the input

Hope this helps

With Regards,
Raghavendra Mudugal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing Parameter in Crystal report 10 aarunlal ASP.NET 2.0 Professional 2 April 25th, 2007 05:57 AM
passing parameter values to the crystal report connect2sandep Crystal Reports 0 December 20th, 2005 06:27 AM
Crystal report, passing parameter suni_kutty Crystal Reports 2 October 7th, 2004 03:13 AM
passing parameter to crystal report.net shamala Crystal Reports 2 August 19th, 2004 02:04 AM
passing parameters at runtime using crystal report anilkumar Crystal Reports 2 January 3rd, 2004 01:35 AM





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