Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Passing Null Parameters Post Reply Post New Topic
Author Message
usmdm82
Newbie
Newbie
Avatar

Joined: 26 Sep 2007
Location: United States
Online Status: Offline
Posts: 8
Quote usmdm82 Replybullet Topic: Passing Null Parameters
    Posted: 26 Sep 2007 at 12:10pm
Does anyone know how to pass null parameters into a Crystal Report through asp.net?  I've tried DbNull.Value, but the report doesn't seem to get it as "null".
 
Any help would be wonderful - I'd rather not have to rework a bunch of stored procedures!
 
Thanks!
Danielle
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 27 Sep 2007 at 2:14pm

AFAIK, you can't.  Crystal will expect some sort of value.  I know that it means re-working the stored procs, but your best bet would be to set some sort of "default" for the param and then have the stored proc treat that value as if it were null.

 
-Dell
IP IP Logged
usmdm82
Newbie
Newbie
Avatar

Joined: 26 Sep 2007
Location: United States
Online Status: Offline
Posts: 8
Quote usmdm82 Replybullet Posted: 28 Sep 2007 at 7:24am
Thanks for your response.
 
As with many things in Crystal, this is very frustrating.  In the Crystal IDE, you are able to pass nulls ("Set to Null Value").  I don't understand why you can't use the same functionality when calling the report from .Net.


Edited by usmdm82 - 28 Sep 2007 at 7:24am
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 28 Sep 2007 at 9:30am
I haven't looked at this in .NET 2005 yet, but in VB.NET 2003 you can do this. Using the object model and the ParameterField class, set the Value property to Nothing. This lets you pass nulls to a stored procedure via code (I cover this on page 362 of my book Crystal Reports .NET Programming).

Edited by BrianBischof - 28 Sep 2007 at 10:55am
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
usmdm82
Newbie
Newbie
Avatar

Joined: 26 Sep 2007
Location: United States
Online Status: Offline
Posts: 8
Quote usmdm82 Replybullet Posted: 28 Sep 2007 at 10:44am
Thank you Brian. 
 
I'm actually using C#, so the value is "null" instead of nothing.  I'm not sure what I was doing wrong before (I really thought I had tried this!), but it is now working! 
 
Thanks again!
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 28 Sep 2007 at 10:50am
Excellent!

The bad thing about Crystal is that it often gets blamed for not being able to do something, when in reality it is just poorly documented. But hey - that gives me more reasons to write these crazy books!


Edited by BrianBischof - 28 Sep 2007 at 10:53am
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.