.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 6th, 2004, 07:12 AM
sphair sphair is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 1 sphair User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Crystal Reports Custom SQL Query Parameter Passing

I'm often using custom SQL to get the data into my crystal reports, using the Add Command to write the SQL query. But I am unable to use any parameters when using this. I see there is a Parameter List, and I can create them and all, but I am unable to get them to work like regular parameters. Anyone succeeded in using these?

Reply With Quote
  #2  
Old April 22nd, 2004, 01:28 PM
kw103 kw103 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 1 kw103 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
yep, you can do it,,,

Following is a code extract:

Have a look, u will be able to understand it..

PrivateSub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

Dim frmReport AsNew Form3

frmReport.ReportViewer.ReportSource = "C:\Documents and Settings\dtdtrd\Desktop\University of Greenwich\Project\FINALPROJECT\OffenceInput\Traffi cOffence.rpt"

'The Parameters in the report

Dim ParamterField AsNew CrystalDecisions.Shared.ParameterField

Dim ParameterField1 AsNew CrystalDecisions.Shared.ParameterField

Dim ParameterField2 AsNew CrystalDecisions.Shared.ParameterField

Dim ParameterField3 AsNew CrystalDecisions.Shared.ParameterField

'A collection of parameters is a parameter field

Dim ParamterFields AsNew CrystalDecisions.Shared.ParameterFields

'Every parameter has a descrete value

Dim ParamterDescreteValue AsNew CrystalDecisions.Shared.ParameterDiscreteValue

Dim ParamterDescreteValue1 AsNew CrystalDecisions.Shared.ParameterDiscreteValue

Dim ParamterDescreteValue2 AsNew CrystalDecisions.Shared.ParameterDiscreteValue

Dim ParamterDescreteValue3 AsNew CrystalDecisions.Shared.ParameterDiscreteValue

'Now each of these parameters should be added a meaning

ParamterField.ParameterFieldName = "OffenceType"

ParameterField1.ParameterFieldName = "Reference"

ParameterField2.ParameterFieldName = "OffenceTitle"

ParameterField3.ParameterFieldName = "Description"

'Each of these parameters should be given a starting value

ParamterDescreteValue.Value = lblOffenceType.Text

ParamterDescreteValue1.Value = lblRefNumber.Text

ParamterDescreteValue2.Value = lblTitle.Text

ParamterDescreteValue3.Value = txtDescription.Text

'All these values should be added to parameter field

ParamterField.CurrentValues.Add(ParamterDescreteVa lue)

ParameterField1.CurrentValues.Add(ParamterDescrete Value1)

ParameterField2.CurrentValues.Add(ParamterDescrete Value2)

ParameterField3.CurrentValues.Add(ParamterDescrete Value3)

'Finally all these parameters should be added to the report

ParamterFields.Add(ParamterField)

ParamterFields.Add(ParameterField1)

ParamterFields.Add(ParameterField2)

ParamterFields.Add(ParameterField3)

'ParameterInfo has been given all the information needed

frmReport.ReportViewer.ParameterFieldInfo = ParamterFields

frmReport.MdiParent =
Me.Parent.FindForm()

frmReport.Show()

EndSub

thanks,



Reply With Quote
  #3  
Old June 13th, 2005, 04:00 AM
request request is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 3 request User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 27 m 39 sec
Reputation Power: 0
passing param fields to add command

I am facing problem with passing parameters to stored procedure from crystal reports. I have added parameter @reportpassingdate in crystal report which is the date given in list box. Here I have taken add command, I wrote

Exec sp_example @date=í{?@reportpassingdate}í

But it is saying cannot convert character string to datetime.

@date datatype in stored procedure is varchar.

@reportpassingdate is of type string.



I stucked here from one week . I am trying to pass this report date to stored procedure. But I didnít find any solution yet.



If you have any idea please help me out.



Thanks & Regards

Request.

Reply With Quote
  #4  
Old August 25th, 2005, 03:35 AM
izura izura is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 1 izura User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 52 sec
Reputation Power: 0
hi...my name is izura.i having a problem like u did...have u get the solution? if u had can u help me to solve it?
tq

Reply With Quote
  #5  
Old December 14th, 2007, 10:05 PM
rudyandy rudyandy is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2007
Posts: 1 rudyandy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 49 sec
Reputation Power: 0
Crystal Reports Custom SQL Query Parameter Passing

Quote:
Originally Posted by kw103
yep, you can do it,,,

Following is a code extract:

Have a look, u will be able to understand it..

PrivateSub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

Dim frmReport AsNew Form3

frmReport.ReportViewer.ReportSource = "C:\Documents and Settings\dtdtrd\Desktop\University of Greenwich\Project\FINALPROJECT\OffenceInput\Traffi cOffence.rpt"

'The Parameters in the report

Dim ParamterField AsNew CrystalDecisions.Shared.ParameterField

Dim ParameterField1 AsNew CrystalDecisions.Shared.ParameterField

Dim ParameterField2 AsNew CrystalDecisions.Shared.ParameterField

Dim ParameterField3 AsNew CrystalDecisions.Shared.ParameterField

'A collection of parameters is a parameter field

Dim ParamterFields AsNew CrystalDecisions.Shared.ParameterFields

'Every parameter has a descrete value

Dim ParamterDescreteValue AsNew CrystalDecisions.Shared.ParameterDiscreteValue

Dim ParamterDescreteValue1 AsNew CrystalDecisions.Shared.ParameterDiscreteValue

Dim ParamterDescreteValue2 AsNew CrystalDecisions.Shared.ParameterDiscreteValue

Dim ParamterDescreteValue3 AsNew CrystalDecisions.Shared.ParameterDiscreteValue

'Now each of these parameters should be added a meaning

ParamterField.ParameterFieldName = "OffenceType"

ParameterField1.ParameterFieldName = "Reference"

ParameterField2.ParameterFieldName = "OffenceTitle"

ParameterField3.ParameterFieldName = "Description"

'Each of these parameters should be given a starting value

ParamterDescreteValue.Value = lblOffenceType.Text

ParamterDescreteValue1.Value = lblRefNumber.Text

ParamterDescreteValue2.Value = lblTitle.Text

ParamterDescreteValue3.Value = txtDescription.Text

'All these values should be added to parameter field

ParamterField.CurrentValues.Add(ParamterDescreteVa lue)

ParameterField1.CurrentValues.Add(ParamterDescrete Value1)

ParameterField2.CurrentValues.Add(ParamterDescrete Value2)

ParameterField3.CurrentValues.Add(ParamterDescrete Value3)

'Finally all these parameters should be added to the report

ParamterFields.Add(ParamterField)

ParamterFields.Add(ParameterField1)

ParamterFields.Add(ParameterField2)

ParamterFields.Add(ParameterField3)

'ParameterInfo has been given all the information needed

frmReport.ReportViewer.ParameterFieldInfo = ParamterFields

frmReport.MdiParent =
Me.Parent.FindForm()

frmReport.Show()

EndSub

thanks,





Well, I'll try using ur code it doesn't work...
In Crystal Report, I use query for example :
SELECT * FROM Employee E
WHERE E.employee_ID = {?ID}

That's it
and then
I write ur code in form.
It doesn't work
Doesn't result anything...
Why? What happened?

Should I add parameter in Parameter Fields on Crystal Report?

Or how do i do to make this works?

Thanks

Regards,


Andy

Reply With Quote
  #6  
Old February 17th, 2011, 01:04 AM
n_uy n_uy is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2011
Posts: 1 n_uy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 35 m 10 sec
Reputation Power: 0
Using custom storedproc n get data into crystal reports via Add Comd parameter

Hello,

I am having exactly the same problem. I have lost sleep over for more than a week now. Does anyone have a solution to this problem?

fyi, i am using crystal reports bundled with .Net 2002.

Thank you so much in advance.

Best regards,

My code below:
SQL SCRIPT:
CREATE PROCEDURE sp_GenerateCustomerSegment
@REPORT_TYPE AS VARCHAR(5) -- YEAR, WEEK, MONTH
WITH ENCRYPTION
AS ....


CRYSTAL REPORT ADD COMMAND:
exec sp_GenerateCustomerSegment @REPORT_TYPE='{?@report_type}'

CRYSTAL REPORTS PARAMETER:
{?report_type}

[IMG]c:\error.jpg[/IMG]

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > Crystal Reports Custom SQL Query Parameter Passing


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap