473,763 Members | 2,714 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating a very simple report: Crystal Report and SetParameterVal ue ?

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 SetParameterVal ue 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: WindowsAppicati on1.

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|WindowsA ppication1|Crys talReport1. 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 .SetParameterVa lue("UnboundStr ing1","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 11043
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.SetParameter Value( "param1", value1);
....
rd.SetParameter Value( "paramN", valueN);

//finally assign the report to the viewer
crystalReportVi ewer1.ReportSou rce = rd;

"Rodo" <ds*****@yahoo. comwrote in message
news:kfgYh.4708 $A72.2324@trndd c07...
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 SetParameterVal ue 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: WindowsAppicati on1.

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|WindowsA ppication1|Crys talReport1. 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 .SetParameterVa lue("UnboundStr ing1","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
9973
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
2617
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 and End Date??? Thanx In Advance Vivek Kumbhojkar
1
1469
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 the report(.rpt) file and made an object for that and am passing the parameters.Finally it gives the error message as, LOGON FAILED.
0
1159
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 folowing error "System.Runtime.InteropServices.COMException: Not enough memory for operation." The change of version may not be the actual cause but I cant trace out what other change I might have done to cause this.
2
2135
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 to be no way to do this when there are parameters in the report. If anyone knows how to export to .pdf in code when there are params, I'd sure appreciate some help. Bernie Yaeger
0
1502
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 huge time to load a report whether it is a 1 page report or thousands page report. We have migrated the project from VB to VB.NET, in VB its working fine because in that report is loaded page by page but in VB.NET whole report is loaded in one go.
3
3945
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 Dim report As New ReportDocument Dim I As Int16
2
5714
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(); thisReport.ExportToDisk(ExportFormatType.PortableDocFormat,outputFilename); thisReport.Close(); This works perfectly. Now I have a crystal report that takes a
2
1914
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 prompted for a user name and password. And even then it won't pull up the report. The crystal report is sourced via a stored procedure. I choose OLD DB (ADO) as the connection source. I couldn't get it to work with an ADO.NET Dataset that I setup in...
0
9563
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9386
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10145
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9998
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9938
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7366
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.