473,394 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Crystal 9 Report Viewer & vb.net 2003

This is driving me mad!!

I have a report viewer on a form that is bound to a sql stored
procedure that has one parameter.

I just can't seem to find a way of passing a parameter to the report
viewer, though can make it prompt for the value when refreshing the
report viewer.
-------
CrystalReportViewer1.ReportSource = Application.StartupPath &
"\view_narrative.rpt"

is about as far as I've got - I've looked at the parameterfieldinfo
collection but don't seem to be getting anywhere.

--------

I've no problems with creating a similar report for direct export to
pdf as below:
Dim crparametervalues As ParameterValues
Dim crparameterdiscretevalue As ParameterDiscreteValue
Dim crparameterfielddefinitions As ParameterFieldDefinitions
Dim crparameterfielddefinition As ParameterFieldDefinition

crparameterfielddefinitions =
myreport.DataDefinition.ParameterFields
crparameterfielddefinition =
crparameterfielddefinitions.Item(0)

crparametervalues = crparameterfielddefinition.CurrentValues
crparameterdiscretevalue = New ParameterDiscreteValue
crparameterdiscretevalue.Value = CType(txtRef.Text, Int32)
crparametervalues.Add(crparameterdiscretevalue)

crparameterfielddefinition.ApplyCurrentValues(crpa rametervalues)

Dim myexportoptions As ExportOptions

Dim myexportfile As String

myexportfile = my_full_output_file_string & "-REP-CSE.PDF"
mydiskfiledestinationoptions.DiskFileName = myexportfile
myexportoptions = myreport.ExportOptions

With myexportoptions

..DestinationOptions = mydiskfiledestinationoptions
..ExportDestinationType = .ExportDestinationType.DiskFile
..ExportFormatType = ExportFormatType.PortableDocFormat

End With

myreport.Export() ' as PDF
-------

Anyone have any ideas on this? I'm sure I'm missing something
fundamental somewhere.

JC

Nov 21 '05 #1
1 1727
Hi JC,

It's easy:
paramField.ParameterFieldName = "firstparam"

paramField2.ParameterFieldName = "secondparam"

discreteVal.Value = "First Parameter"

discreteVal2.Value = "Second Parameter"

paramField.CurrentValues.Add(discreteVal)

paramField2.CurrentValues.Add(discreteVal2)

paramFields.Add(paramField)

paramFields.Add(paramField2)

CrystalReportViewer1.ParameterFieldInfo = paramFields

then run the report

Now of course you could use global variables as well as the literal strings
that I used in the example above.

HTH,

Bernie Yaeger

"JC - home" <jo**@johnclark.me.uk> wrote in message
news:10**********************@f14g2000cwb.googlegr oups.com...
This is driving me mad!!

I have a report viewer on a form that is bound to a sql stored
procedure that has one parameter.

I just can't seem to find a way of passing a parameter to the report
viewer, though can make it prompt for the value when refreshing the
report viewer.
-------
CrystalReportViewer1.ReportSource = Application.StartupPath &
"\view_narrative.rpt"

is about as far as I've got - I've looked at the parameterfieldinfo
collection but don't seem to be getting anywhere.

--------

I've no problems with creating a similar report for direct export to
pdf as below:
Dim crparametervalues As ParameterValues
Dim crparameterdiscretevalue As ParameterDiscreteValue
Dim crparameterfielddefinitions As ParameterFieldDefinitions
Dim crparameterfielddefinition As ParameterFieldDefinition

crparameterfielddefinitions =
myreport.DataDefinition.ParameterFields
crparameterfielddefinition =
crparameterfielddefinitions.Item(0)

crparametervalues = crparameterfielddefinition.CurrentValues
crparameterdiscretevalue = New ParameterDiscreteValue
crparameterdiscretevalue.Value = CType(txtRef.Text, Int32)
crparametervalues.Add(crparameterdiscretevalue)

crparameterfielddefinition.ApplyCurrentValues(crpa rametervalues)

Dim myexportoptions As ExportOptions

Dim myexportfile As String

myexportfile = my_full_output_file_string & "-REP-CSE.PDF"
mydiskfiledestinationoptions.DiskFileName = myexportfile
myexportoptions = myreport.ExportOptions

With myexportoptions

.DestinationOptions = mydiskfiledestinationoptions
.ExportDestinationType = .ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat

End With

myreport.Export() ' as PDF
-------

Anyone have any ideas on this? I'm sure I'm missing something
fundamental somewhere.

JC

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Stephan | last post by:
Hi, I'm using Visual Studio 2003 (C#) with the integrated Crystal Report software and have the following question: How can I assign a value (string) to an unbound (string) field in Crystal...
2
by: Jeannette | last post by:
Hi! there, I am currently working on web-based reports using crystal reports.NET 2003 and I am new to this reporting tool. I notice that the WEB forms report viewer toolbar does not include the...
5
by: Robert Schuldenfrei | last post by:
Hi Again, Forgive me for posting this again, but old items seem to get little review. I thought I could adjust the viewer properties without any further aid from the NG, but I was wrong. When...
0
by: Craig Faulkner | last post by:
I have been fighting through my first crystal report in VS2003.NET and have made some headway. Here is what I've done: 1. Created a crystal report in VS2003 from a SQL stored procedure with...
1
by: Grey | last post by:
I am going to design a web application with crystal report for more than 200 users. I will use the crystal report viewer component in IE. I want to know how to calculating the license?? Do I pay to...
3
by: Trichy | last post by:
Hi Can any one help me. I added crystal report item to my project .net. After connecting to database , i inserted three columns from table. I ran report in ..net is working fine. My problem, ...
0
by: Chris | last post by:
I have the following situation in a VB.Net App I am working on: 1.)A report created in VS.Net 2003 using the CR.Net component of VS 2003. 2.)The datasource for the report is a Stored Proc in a...
0
by: John Smith | last post by:
Hello, I am developing a VB.NET 2003 application that will use lots of Crystal Reports. Sometimes the users will preview a report in a Crystal report viewer, and sometimes they will send the...
1
by: ramaswamynanda | last post by:
Hello, I am new to Crystal Reports. I need to create a chart in Crystal Reports and put it into a web form in VB.Net 2003 1. The chart takes its data from a simple table in SQLServer 2005. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.