Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Executereader has no records
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01501091
Message ID:
01516372
Views:
33
Have you tried:

IF rdrCount["CALLS"].Value = DbNull.Value
'Nothing matches
ELSE
the actual value

>Hi Naomi
>
>My select command is:
>SELECT SUM(CALLCOUNT) AS CALLS FROM BI.dbo.BI01 WHERE .....
>
>This is the problem. Sometimes One record will be returned (with Null ?) and other times it will be numeric (The actual Sum)
>How do I say:
>if (Calls = Null)
> { MyCount = 0 ;}
>Else
> { MyCount = Calls ;}
>
>Tia Gerard
>
>
>
>>What is your select statement? If your select has SUM in it and there are no records satisfying the condition, it will result in one record with NULL in the SUM field.
>>
>>>Hi Naomi.
>>>
>>>Just comong back to this now.
>>>Still dont know how to get the count in Sql and test it.
>>>x=Convert.ToInt32(Convert.ToDouble(rdrCount["CALLS"].ToString().Trim()))
>>>
>>>If I use the above, and zero records are 'calculated', a single record with a Blank in CALLS field is returned
>>>If say 20 records are returned, 20 (an INT) is returned in CALLS
>>>
>>>Is there a way to test the Type of CALLS in c#
>>>
>>>----- Pseudo Code ----------
>>>
>>>If TYpe(Calls) is Blank and Calls = Spaces
>>> Then assume no records returned
>>>Else
>>> x=Convert.ToInt32(Convert.ToDouble(rdrCount["CALLS"].ToString().Trim()))
>>>Endif
>>>
>>>
>>>Regards,
>>>Gerard
>>>
>>>
>>>
>>>
>>>>>Ni Naomi.
>>>>>I'm running VFP8
>>>>>I wonder why this woudl have changed from 8 to 9
>>>>>regards,
>>>>>Gerard
>>>>>
>>>>>
>>>>It was changed in VFP9 to be more ANSI-SQL standard. It sure caused some maintenance and hard to find bugs, although the behavior is documented and also was discussed here in the forum.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform