473,473 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Creating a very simple report: Crystal Report and SetParameterValue ?

Hi all,

I'm trying to generate a simple crystal report without a database. Several
people mention the use of a dataset. Someone mention in a msdn forum that I
could use the SetParameterValue to easily fill the fields in a simple
report. So. I looked at datasets and I think I'll try this way first. I'm
pretty new and I still don't understand much of this stuff. So. here is what
I did . and it is not working :-(.

1.-create new windows application: WindowsAppication1.

2.-from the toolbox I add a 'ReportDocument'. This brings up the 'Choose a
ReportDocument" window. There is only one choice in the dropdown box:
'Untyped ReportDocument'. Pressed OK. ReportDocument shows below the form.

3.-Project|add New Item| Crystal Report. CrystalReport1.rpt. This brings up
the 'type of report' window from crystal report. I choose blank report. Then
I add an "unbounded text" field to section 2 (page header) of the report
file. I figure I'll try this with only one field first.

4.-Back to the form[design]. Click on Data source and add a new source.
Options are: Database, web service, object. I picked
object|WindowsAppication1|CrystalReport1. Clicked on the finished button.

5.- I selected the DocumentReport1 icon below the form and change the 'Name'
property to the CrystalReport1 file I created in number 3 above.
The truth is, I don't know what to do in number 4. There are several
choices. I picked Form1 while trying and there isn't any effects I can see.
Now I'm thinking that everything went pretty well, no errors, no warnings !
(It compiles and runs ok). Of course, there is nothing in the form yet. I
added a button and try this:

reportDocument1.SetParameterValue("UnboundString1" ,"abcde");

I get an exception telling me that the index is incorrect. Yeap, I have no
clue why. I guess 'UnboundString1' is not the name of the field. I think I'm
missing something :-( .. Or maybe is a whole bunch :-).

I like to be able to
(1) change the value in the text field I created in the .rpt file
(2) and later preview it
(3) and print it.

Could someone point me in the right direction for changing the field through
a button's on_click event. I'll deal with the other two issues later :-).

Thanks a bunch.
Apr 27 '07 #1
1 10996
Hi,

I usually use Dataset to generate reports, I find it easier and more
configurable.

If you want to just generate a simple report you could use only parameters,
I have done this in the past to be able to print a nicely formatted page.

Basically you create your report as you mentioned. After that you add the
parameters you need.

Once the report has all the required parameters you go to code view and code
it like this:

ReportDocument rd = new MyReportName()
rd.SetParameterValue( "param1", value1);
....
rd.SetParameterValue( "paramN", valueN);

//finally assign the report to the viewer
crystalReportViewer1.ReportSource = rd;

"Rodo" <ds*****@yahoo.comwrote in message
news:kfgYh.4708$A72.2324@trnddc07...
Hi all,

I'm trying to generate a simple crystal report without a database. Several
people mention the use of a dataset. Someone mention in a msdn forum that
I could use the SetParameterValue to easily fill the fields in a simple
report. So. I looked at datasets and I think I'll try this way first. I'm
pretty new and I still don't understand much of this stuff. So. here is
what I did . and it is not working :-(.

1.-create new windows application: WindowsAppication1.

2.-from the toolbox I add a 'ReportDocument'. This brings up the 'Choose a
ReportDocument" window. There is only one choice in the dropdown box:
'Untyped ReportDocument'. Pressed OK. ReportDocument shows below the form.

3.-Project|add New Item| Crystal Report. CrystalReport1.rpt. This brings
up the 'type of report' window from crystal report. I choose blank report.
Then I add an "unbounded text" field to section 2 (page header) of the
report file. I figure I'll try this with only one field first.

4.-Back to the form[design]. Click on Data source and add a new source.
Options are: Database, web service, object. I picked
object|WindowsAppication1|CrystalReport1. Clicked on the finished button.

5.- I selected the DocumentReport1 icon below the form and change the
'Name' property to the CrystalReport1 file I created in number 3 above.
The truth is, I don't know what to do in number 4. There are several
choices. I picked Form1 while trying and there isn't any effects I can
see. Now I'm thinking that everything went pretty well, no errors, no
warnings ! (It compiles and runs ok). Of course, there is nothing in the
form yet. I added a button and try this:

reportDocument1.SetParameterValue("UnboundString1" ,"abcde");

I get an exception telling me that the index is incorrect. Yeap, I have no
clue why. I guess 'UnboundString1' is not the name of the field. I think
I'm missing something :-( .. Or maybe is a whole bunch :-).

I like to be able to
(1) change the value in the text field I created in the .rpt file
(2) and later preview it
(3) and print it.

Could someone point me in the right direction for changing the field
through a button's on_click event. I'll deal with the other two issues
later :-).

Thanks a bunch.


Apr 27 '07 #2

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

Similar topics

10
by: Lalit Parashar | last post by:
Hi, I am clueless on how to integrate stored procedure in Crystal Reports using C#. Any pointers please? Thanks Lalit
3
by: Vivek | last post by:
Hi All, I am using .Net studio C sharp windows application (WinForm). Crystal reports r running fine.. I want to diplay report with conditions... Want to pass parameters to CR.. e.g. Start Date...
1
by: Raghu Raman | last post by:
Hi, am using crystal report in my c#.net The report was initially designed with the RDO Connection and uses the stroed proc,This sp requires 4 parameters.In my c# web app , i simply included...
0
by: Deeraj | last post by:
Hi, I am developing an ASP.NET application which uses Crystal reports 9. It was working fine. But later I installed the trial Crystal Report 11. After that the generating of the reports gives the...
2
by: Bernie Yaeger | last post by:
I'm working with Brian Bischof's excellent 'crystal reports .net programming', but I'm having one problem: I can export to .pdf in code, no problem, using the exporttodisk method, but there appears...
0
by: kamboj.shalabh | last post by:
Hi to all, Well, I am working on dotnet 2005 with crystal reports 10 and backend as sql server. I am facing a problem while loading a report. Actually the issue is, when I load report it takes...
3
by: =?Utf-8?B?ZHJhYmVl?= | last post by:
Greetings: Please This is the first time i'm using crystal report i'm passing Parameters like code belowe but what i'm getting alwayes just the last record pleeeeeeeeeeeeeeeease any help ...
2
by: Philluminati | last post by:
I have a crystal report which I need my application to generate. I can do it like this: ReportDocument thisReport = new ReportDocument(); thisReport.Load(inFilename); thisReport.Refresh();...
2
by: Bill Schanks | last post by:
I have a VB.NET 2005 Winform app that has a crystal report. It comes up fine when I run the app on the Dev machine. But when I run the app on a users machine, even logged in as myself, I get...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.