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 January 2nd, 2004, 02:11 PM
Registered User
Points: 33, Level: 1
Points: 33, Level: 1 Points: 33, Level: 1 Points: 33, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: chennai, TamilNadu, India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to tbhakee
Default Passing parameters to crystal reports at runtime

Help me in passing parameters to crystal reports at run time in vb.net with out showing that ugly enter parameter dialog.
Another problem i encountered is when i iterate thro' the data in a data table and filter only a specific data based on a specific field ,i get blank lines for all those fields that were false ie. those that does not satisfy the condition.


Loving,
ßhakee.T
__________________
Loving,
ßhakee.T
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old January 4th, 2005, 05:00 PM
Registered User
Points: 2, Level: 1
Points: 2, Level: 1 Points: 2, Level: 1 Points: 2, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Agawam, ma, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here's an easy way to pass parameters
' Declare variables needed to pass the parameters to the viewer control.
            Dim paramFields As New ParameterFields
            Dim paramField As New ParameterField
            Dim discreteVal As New ParameterDiscreteValue

' The first parameter is a discrete parameter with multiple values.
' Set the name of the parameter field, this must match a parameter in the report.
            paramField.ParameterFieldName = "@LevyYear"
'*** SETTING THE FIRST DISCRETE VALUE & PASS IT TO THE PARAMETER ***
            discreteVal.Value = "Levy Year: " & glbLevyYear
            paramField.CurrentValues.Add(discreteVal)
'*** ADDING THE PARAMETER TO THE PARAMETER FIELDS COLLECTION ***
            paramFields.Add(paramField)

 '*** PASSING A SECOND PARAMETER (DISCRETE VALUE) ***
            paramField = New ParameterField
            paramField.ParameterFieldName = "@Description"
            discreteVal = New ParameterDiscreteValue
            discreteVal.Value = "Levy Year: " & glbLevyYear & " | Commitment Number: " & glbCommitNumber
            paramField.CurrentValues.Add(discreteVal)
            paramFields.Add(paramField)
'*** DON'T FORGET TO ALWAYS ADD THE PARAMETER TO THE PARAMFIELDS AFTER ENTERING THE VALUE *** IT MUST BE ADDED AFTER EACH NEW PARAMETER ***

'*** SET THE PARAMETER FIELDS COLLECTION INTO THE VIEWER CONTROL ***
            crpViewer.ParameterFieldInfo = paramFields


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old May 25th, 2005, 12:39 PM
Registered User
Points: 7, Level: 1
Points: 7, Level: 1 Points: 7, Level: 1 Points: 7, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2004
Location: Logan, UT, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

So after I have that setup, how do I incorporate that into my report? Where do I put the parameter to use it? Please help! Thanks!

__________________
Brenda

If it weren't for you guys, where would I be?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old May 26th, 2005, 01:31 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

Dear friend: what version of CR & VB u r useing?!
If u use .NET I suggest to use DataSet Fill it with a DataAdapter & then pass DataSet to Report Obj.
But if u still dont want, the given sample is quite OK.

Always:),
Hovik Melkomian.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old June 1st, 2005, 04:04 AM
Registered User
 
Join Date: Jun 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi there..
I use asp.net and crystal 9 for my proj.i facing the prob in passing parameter to crystal report. i tried the above solution on my webpage which contains the crystal report viewer, but i get the incorrect symptom of "[u]Type 'ParameterFields' not defined</u>" , thus i simply cant go forward with trying out the code given above...
Am i on the wrong page??
i tried filling the dataset.the dataset gets filled but again, i am not able to pass the paramater...
 what should i do???



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #6 (permalink)  
Old April 16th, 2006, 03:09 PM
Registered User
Points: 33, Level: 1
Points: 33, Level: 1 Points: 33, Level: 1 Points: 33, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: chennai, TamilNadu, India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to tbhakee
Default

Thanks sancy2k.

Loving,
ßhakee.T
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #7 (permalink)  
Old July 14th, 2006, 11:16 PM
Registered User
 
Join Date: Jul 2006
Location: Madison, Wisconsin, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How is this done for Windows Forms? I am trying to print a report and there isn't a viewer and I don't see a method or property ParameterInfo?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #8 (permalink)  
Old July 29th, 2006, 03:30 PM
Registered User
 
Join Date: Dec 2005
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi RKevinBurton,
In windows forms you should find a crystal report viewer in the toolbar, should be the last one. Then you'll need to add a New Item to your project (from the solution explorer); you guessed it, a Crystal Report. Set up your crystal report and set the Report Source property of your crystal report viewer to the newly created crystal report (you'll need to browse to its location).
And you'll need this namespace to declare parameter fields:
Code:
CrystalDecisions.Shared
:)Hope this helps!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #9 (permalink)  
Old May 21st, 2007, 03:09 AM
Registered User
 
Join Date: May 2007
Location: Delhi, New Delhi, India.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ravishdhingra82 Send a message via Yahoo to ravishdhingra82
Default

Hi, My name is Ravish. I am having some problem while passing parameters for crystal report.

my syntax is
cmd.parameters.add("@SLCODE",slcode)
where slcode is an integer at front-end and @SLCODE is varchar in stored procedure.

Actually i am showing this report for every months as I am making payroll system. When I choose March My report opens automatically without any problem. But if I choose April It gives an error "Syntax error converting the varchar value null to coloumn of datatype int".

Also when I checked the syntax "cmd.parameters.add("@SLCODE",slcode)" in immidiate window. Ths syntax gives value "Nothing", but for march this syntax gives value "" (string).

Please if anyone have any idea about this error. do help me.ASAP

Thanks
Regards
RavishDhingra

Ravish Dhingra
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #10 (permalink)  
Old July 24th, 2008, 04:52 AM
Registered User
 
Join Date: Jul 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

try this

        Dim crParameterFieldDefinitions As ParameterFieldDefinitions
        Dim crParameterFieldDefinition As ParameterFieldDefinition
        Dim crParameterValues As New ParameterValues
        Dim crParameterDiscreteValue As New ParameterDiscreteValue

        crParameterDiscreteValue.Value = Convert.ToInt32(TextBox1.Text)
        crParameterFieldDefinitions = _
                cryRpt.DataDefinition.ParameterFields
        crParameterFieldDefinition = _
                crParameterFieldDefinitions.Item("Price")
        crParameterValues = crParameterFieldDefinition.CurrentValues


check the following link

http://vb.net-informations.com/cryst...er_integer.htm


leveena


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
passing parameters to crystal reports Shubhi ASP.NET 2.0 Professional 0 July 4th, 2008 03:18 AM
Passing parameters w/o prompt to Crystal Reports VannAustin BOOK: Professional Crystal Reports for VS.NET 1 August 31st, 2006 09:46 AM
Passing Parameters to crystal reports through codi secrets Crystal Reports 0 April 5th, 2005 02:44 PM
Passing parameters w/o prompt to Crystal reports VannAustin VB How-To 0 March 2nd, 2005 02:16 AM
passing parameters at runtime using crystal report anilkumar Crystal Reports 2 January 3rd, 2004 01:35 AM



All times are GMT -4. The time now is 11:03 PM.


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