473,804 Members | 2,008 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with Crystal Report

Hi, i have a simple report with 1 parameter and i want to send it to
the printer without use the crystalreportvi ewer but it shows me an
exception "Parameter value is needed",maybe the problem can be in the
way to pass it the parameter.
CrystalReport1 cr = null;
try
{
cr = new CrystalReport1( );
cr.FileName="C: \\Proyectos .Net\\crystal\\ CrystalReport1. rpt";
cr.Load();

cr.SetParameter Value("person", "000002");
cr.PrintOptions .PrinterName = "\\\\ACTEA3\\lj 4000";

cr.Refresh();
cr.PrintToPrint er(1,false,0,0) ;
}

Any idea would be apreciated.

Nov 17 '05 #1
7 5778
Hi,

IIRC you do not need to load it from File, it's embedded as a resource and
when you instantiate it its load

if you just show it in the screen does it work ok?
do you have a default printer set?, can you just try with it instead of
using a network printer?

the parameter seems to be ok,

If that do not work, what if you use a crystalreportvi ewer but do not show
it, you load the report, etc but then just print it
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Victor" <vi************ @actea.es> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Hi, i have a simple report with 1 parameter and i want to send it to
the printer without use the crystalreportvi ewer but it shows me an
exception "Parameter value is needed",maybe the problem can be in the
way to pass it the parameter.
CrystalReport1 cr = null;
try
{
cr = new CrystalReport1( );
cr.FileName="C: \\Proyectos .Net\\crystal\\ CrystalReport1. rpt";
cr.Load();

cr.SetParameter Value("person", "000002");
cr.PrintOptions .PrinterName = "\\\\ACTEA3\\lj 4000";

cr.Refresh();
cr.PrintToPrint er(1,false,0,0) ;
}

Any idea would be apreciated.

Nov 17 '05 #2
Hi,

IIRC you do not need to load it from File, it's embedded as a resource and
when you instantiate it its load

if you just show it in the screen does it work ok?
do you have a default printer set?, can you just try with it instead of
using a network printer?

the parameter seems to be ok,

If that do not work, what if you use a crystalreportvi ewer but do not show
it, you load the report, etc but then just print it
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Victor" <vi************ @actea.es> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Hi, i have a simple report with 1 parameter and i want to send it to
the printer without use the crystalreportvi ewer but it shows me an
exception "Parameter value is needed",maybe the problem can be in the
way to pass it the parameter.
CrystalReport1 cr = null;
try
{
cr = new CrystalReport1( );
cr.FileName="C: \\Proyectos .Net\\crystal\\ CrystalReport1. rpt";
cr.Load();

cr.SetParameter Value("person", "000002");
cr.PrintOptions .PrinterName = "\\\\ACTEA3\\lj 4000";

cr.Refresh();
cr.PrintToPrint er(1,false,0,0) ;
}

Any idea would be apreciated.

Nov 17 '05 #3
Hi, i tested to show it in the screen and it worked ok,i tested to use
the crystalreportvi ewer and the parameters worked ok but the problem
was that i can't or i don't find how to specify the printer i want to
use in the crystalreportvi ewer component, it printed by default printer
on the computer.

Nov 17 '05 #4
Hi, i tested to show it in the screen and it worked ok,i tested to use
the crystalreportvi ewer and the parameters worked ok but the problem
was that i can't or i don't find how to specify the printer i want to
use in the crystalreportvi ewer component, it printed by default printer
on the computer.

Nov 17 '05 #5
I have found the solution, here is the code, thanks for the help.

CrystalReport1 cr = null;
ParameterFieldD efinitions crParameterFiel dDefinitions;
ParameterFieldD efinition crParameterFiel dDefinition;
ParameterValues crParameterValu es;
ParameterDiscre teValue crParameterDisc reteValue;

try
{
cr = new CrystalReport1( );
cr.FileName = "C:\\Proyec tos
..Net\\granitos \\crystal\\Crys talReport1.rpt" ;

//Get the collection of parameters from the report
crParameterFiel dDefinitions = cr.DataDefiniti on.ParameterFie lds;

//Access the specified parameter from the collection
crParameterFiel dDefinition = crParameterFiel dDefinitions["persona"];

//Get the current values from the parameter field. At this point
//there are zero values set.
crParameterValu es = crParameterFiel dDefinition.Cur rentValues;

//Set the current values for the parameter field
crParameterDisc reteValue = new ParameterDiscre teValue();
crParameterDisc reteValue.Value = "000002"; //1st current value

//Add the first current value for the parameter field
crParameterValu es.Add(crParame terDiscreteValu e);

//All current parameter values must be applied for the parameter field.
crParameterFiel dDefinition.App lyCurrentValues (crParameterVal ues);

cr.PrintOptions .PrinterName = "\\\\ACTEA3\\lj 4000";
cr.PrintToPrint er(1,false,0,0) ;
}

Nov 17 '05 #6
I have found the solution, here is the code, thanks for the help.

CrystalReport1 cr = null;
ParameterFieldD efinitions crParameterFiel dDefinitions;
ParameterFieldD efinition crParameterFiel dDefinition;
ParameterValues crParameterValu es;
ParameterDiscre teValue crParameterDisc reteValue;

try
{
cr = new CrystalReport1( );
cr.FileName = "C:\\Proyec tos
..Net\\granitos \\crystal\\Crys talReport1.rpt" ;

//Get the collection of parameters from the report
crParameterFiel dDefinitions = cr.DataDefiniti on.ParameterFie lds;

//Access the specified parameter from the collection
crParameterFiel dDefinition = crParameterFiel dDefinitions["persona"];

//Get the current values from the parameter field. At this point
//there are zero values set.
crParameterValu es = crParameterFiel dDefinition.Cur rentValues;

//Set the current values for the parameter field
crParameterDisc reteValue = new ParameterDiscre teValue();
crParameterDisc reteValue.Value = "000002"; //1st current value

//Add the first current value for the parameter field
crParameterValu es.Add(crParame terDiscreteValu e);

//All current parameter values must be applied for the parameter field.
crParameterFiel dDefinition.App lyCurrentValues (crParameterVal ues);

cr.PrintOptions .PrinterName = "\\\\ACTEA3\\lj 4000";
cr.PrintToPrint er(1,false,0,0) ;
}

Nov 17 '05 #7
Hi Victor,

Ok, good to know

Cuidate ;)
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Victor" <vi************ @actea.es> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
I have found the solution, here is the code, thanks for the help.

CrystalReport1 cr = null;
ParameterFieldD efinitions crParameterFiel dDefinitions;
ParameterFieldD efinition crParameterFiel dDefinition;
ParameterValues crParameterValu es;
ParameterDiscre teValue crParameterDisc reteValue;

try
{
cr = new CrystalReport1( );
cr.FileName = "C:\\Proyec tos
.Net\\granitos\ \crystal\\Cryst alReport1.rpt";

//Get the collection of parameters from the report
crParameterFiel dDefinitions = cr.DataDefiniti on.ParameterFie lds;

//Access the specified parameter from the collection
crParameterFiel dDefinition = crParameterFiel dDefinitions["persona"];

//Get the current values from the parameter field. At this point
//there are zero values set.
crParameterValu es = crParameterFiel dDefinition.Cur rentValues;

//Set the current values for the parameter field
crParameterDisc reteValue = new ParameterDiscre teValue();
crParameterDisc reteValue.Value = "000002"; //1st current value

//Add the first current value for the parameter field
crParameterValu es.Add(crParame terDiscreteValu e);

//All current parameter values must be applied for the parameter field.
crParameterFiel dDefinition.App lyCurrentValues (crParameterVal ues);

cr.PrintOptions .PrinterName = "\\\\ACTEA3\\lj 4000";
cr.PrintToPrint er(1,false,0,0) ;
}

Nov 17 '05 #8

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

Similar topics

1
19189
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 Report at runtime? Example: private void button1_Click(object sender,
0
2609
by: Max | last post by:
Hi wise people, Has anyone encountered the Crystal Reports problem I describe below? If so, how did you solve it? It seems that every article posted on google regarding CR and logon problems is still unanswered. I think I'm cursed. I originally created a crystal report which connects to a sql server server db on the same dev machine and it worked just fine. I tried to move it to another computer, but now I have to connect to an Oracle...
0
1881
by: Plunaldo | last post by:
Hi All I use a ODBC Connection to Connect to a AS400 System. I created a new DSN in the Windows System. The Databaseaccess is made directly out of the Crystal Report...so the Crystal Report is bound to the DSN i made in my Windowssystem. My Question is...How can i make a deploymentpackage and deploy my stuff on a customer machine with a diffrent DSN...can i specify the DSN somewhere outside Crystal Report to change it to a new one? or do i...
0
6301
by: mharris | last post by:
I need help with merging two Word documents into one through C# code. The problem isn't so much getting the documents put into one as it is maintaining the appropriate formatting, or rather reformating, after the merge. This is a full description of my needs. I have a C# class library that creates two Crystal Reports, and then exports them to the harddrive as Word documents. One's orientation is landscape, the other is portrait. I then...
3
15040
by: Milan Todorovic | last post by:
Hello, I need help. I have experience in ASP.NET programming, but this is my first dealing with Crystal Reports. I'm trying to make the most basic report purely for testing purposes: connect to the remote SQL DB and create a report on one of the tables. Every time I do it, I get the Logon Failed error (CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed) The internet search shows that this is a common problem,...
3
11015
by: route_coder | last post by:
I am using access database to create a crystal report in VB.NET Everything works fine when I run on my machine. But when I am deploying it other windows machines. It is asking for database server name and logon information. The problem which I understood from this is that the path is hardcoded in the crystal report and the database is in my bin folder. when I run my app on other machines it is looking for the database in that folder and...
0
1683
by: Monali | last post by:
Hi, I created a ASP.NET crystal reports web site in VS 2005. I wanted to display the data in a DataSet in the Crystal Reports viewer control. I am getting the DataSet from another dll. The documentation says that I need to add a new item - Crystal report, with a blank report in the project which will automatically create a class say CrystalReport1 in my project (if the name of the crystal report added is CrystalReport1.rpt). I should...
1
1506
by: Sean Chiu | last post by:
Hi all, I have a problem on crystal report xml report service. After I finished a simple report service and tested it in local IIS, it works. However, when publishing it to a production IIS (another webserver in separate PC) , the following error error message is prompted. /************************************************************************************/ Could not load file or assembly 'CrystalDecisions.Web, Version=10.2.3600.0,...
1
1189
by: sushanta | last post by:
Dear sir, In details my problem is: What I want to do: Populate data from database in the crystal report with a specific query What I have done: I have decleared a dataset YWStatus.xsd in xsd file I have decleared a DataTable Named YWSdt the columns are
1
1742
by: pintoo | last post by:
Hi, I have 2 sites (Site A, B) running on same windows 2003 server pointing to different home directories. User logs into site A and is shown a.aspx page and user credentials are saved in cookies. There is a link to launch site B from Site A. User clicks the link and is shown Site B - b.aspx. I have a crystal report on b.aspx which user can run. Crystal report is exported into pdf and saved to a folder on the server and displayed to...
0
10595
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...
1
10335
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,...
0
10088
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9169
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6862
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
5529
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...
1
4306
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 we have to send another system
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
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.