473,655 Members | 3,112 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Crystal Report function-pls help

Hello Everybody,
I am trying to write a crystal report function which should return a value
of 1 for crystal report with no parameter and return a value 2 for crystal
report with parameter.

Public Function LoadReport(ByVa l reportname As String, ByRef patable As
System.Web.UI.W ebControls.Tabl e) As Integer

Doccr = New CrystalDecision s.CrystalReport s.Engine.Report Docum ent '
instantiate a report document

Doccr.Load(repo rtname) ' load the report whose name you were given
Dim value As Integer = 0

If Doccr.IsLoaded Then
Dim crParamFieldDef initions As
CrystalDecision s.CrystalReport s.Engine.Parame terFi eldDefinitions =
Doccr.DataDefin ition.Parameter Fields

If crParamFieldDef initions.Count < 1 Then 'if no params,
Return value = 1
End if

If crParamFieldDef initions.Count > 1 Then ' with parameter
return value=2
End if

End if ' End of Doccr.IsLoaded

End Function
For some reason when I click the crystal report button with no parameter I
get the value as 0 (should return 1)and also when I click the crystal
report button with parameter I get the value as 0. (should return 2)
Would be greatful if someone helps with this function..

Rahil

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #1
1 1459
Rahil,

There are a couple of problems with your function.

First you are returning "Return value = 1", isn't this doing a compare of
value being equal to 1, this will always return 0 (False) as value is equal
to 0. Try putting it on two lines:
value = 1
Return value

The other problem is if there is only one parameter on the report you will
also get zero. The "If crParamFieldDef initions.Count > 1 Then ' with
parameter" line should read ">=".

Hope this helps.
Chris.
"Kapil Shah via DotNetMonster.c om" wrote:
Hello Everybody,
I am trying to write a crystal report function which should return a value
of 1 for crystal report with no parameter and return a value 2 for crystal
report with parameter.

Public Function LoadReport(ByVa l reportname As String, ByRef patable As
System.Web.UI.W ebControls.Tabl e) As Integer

Doccr = New CrystalDecision s.CrystalReport s.Engine.Report Docum ent '
instantiate a report document

Doccr.Load(repo rtname) ' load the report whose name you were given
Dim value As Integer = 0

If Doccr.IsLoaded Then
Dim crParamFieldDef initions As
CrystalDecision s.CrystalReport s.Engine.Parame terFi eldDefinitions =
Doccr.DataDefin ition.Parameter Fields

If crParamFieldDef initions.Count < 1 Then 'if no params,
Return value = 1
End if

If crParamFieldDef initions.Count > 1 Then ' with parameter
return value=2
End if

End if ' End of Doccr.IsLoaded

End Function
For some reason when I click the crystal report button with no parameter I
get the value as 0 (should return 1)and also when I click the crystal
report button with parameter I get the value as 0. (should return 2)
Would be greatful if someone helps with this function..

Rahil

--
Message posted via http://www.dotnetmonster.com

Nov 19 '05 #2

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

Similar topics

1
7898
by: Chris Neal | last post by:
I recenetly purchased VB.net standard and in the box was a card saying that it included crystal reports (as it always used to) but I cannot find CR in the templates or in the toolbox. Can anyone tell me where I can download it, or how I might install it if it is already there. Thanks
13
15157
by: kristoff plasun | last post by:
I have a problem with a C++ DCOM application that prints Crystal Reports with data from Oracle. The SQL query is relatively complex but when the report is printed from the Crystal Reports designer it shows up very fast. When the report is printed from my application it takes about ten times as long to get the report to appear. When printing straight from the Crystal Reports
0
4484
by: Dr. Indera | last post by:
hello, i previously posted the questions below on several crystal reports newsgroups, including the one for the company that makes crystal reports, but never got an answer, so i'm hoping that someone on this board knows the answers to them. the questions are for the version of crystal that ships with visual studio.net 2003. if it helps, the reports that i create are in a visual basic.net project. it was recommended that i post the...
1
334
by: Michael O'Donnell | last post by:
Hi All Am having major problem with crystal reports...Have designed my report no problem, its when I try to run and display ther report that I am getting a "Login Failed" message. At first I thought it might have to do with the regristration key, but that ok, when I right click on Servers in the server explorer and then expand the Crystal Server, there is a red x beside the Crystal Enterprise. When I click on log in, I am asked for a
1
12159
by: Karthic | last post by:
When i right click on the .rpt file in the VS 2003, i see a property printer setting. It says "No printer" on the top and there is option to select printer and paper settings etc.. I want to know how will this affect a report rendered by a crystal viewer. I have a web page with a crystal viewer rendering the report on the page. I build my application in one of my development machines and deploy it
0
3786
by: BATISTA | last post by:
Hi , I am working in c# with crystal report XI. I read an example about dynamic image location .. 1) In that we have a xml xchema file with two fields n amed country--datatype is string, img--datatype is base64Binary. using this as the datasource,i have designed the crytal report. And a parameter is set asking for the name. 2) I have designed teh form by adding a crystal report viewer and
0
3634
by: Dean Sabella | last post by:
Hi, I was trying to run a crystal report in the .net sample application given at: http://support.crystaldecisions.com/communityCS/FilesAndUpdates/ cppnet_win_subreport_basic.exe.asp (I've reproduced the relevant file below.)
0
4795
by: Simon | last post by:
Hi, I am using ASP.NET with C# and Crystal Report. I have a textbox et a asp.net button. I send a number in the texte, I push the button and I want to see the report with value related to the number in the textbox. The problem is that I need to call the crystal report function in the "override protected void OnInit(EventArgs e)" function to see my graphic and picture in the report. When I push the button, the content of the textbox is not...
0
2264
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 SQL Server DB (pull method). 3.)The Stored Proc has two input parameters of type date. 4.)The Stored Proc is a rather complex proc that was not written by me, but does work(see next item). It currently returns about 13K rows of data. 5.)The...
11
9678
by: =?Utf-8?B?cmtibmFpcg==?= | last post by:
How can I stop receiving this message while calling a crystal report? "The report you requested requires further information." Thanks
0
8380
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
8296
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
8710
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
8497
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
8598
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
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2721
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
1928
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1598
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.