TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jes Sie
741
1.2k
281.9k
How to set sum to 0 if no data is found from the Database
Sep 12 2017 4:22 AM
Hello DBA's once again I needed help.
I have this query which will give me the sum of all sold insurance.
select
e.AgentID,
sum
(
isnull
(e.TotalPremium,0))
from
tblMotorInsurance_eCI e
where
e.AgentID=
@AgentID
group
by
e.AgentID;
I give me the answer I needed if the agent has a sale. but if the agent doesn't have any record yet, it gives me this error:
Server Error in '/' Application.
There is no row at position 0.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IndexOutOfRangeException: There is no row at position 0.
Source Error:
Line 102: catch (Exception ex)
Line 103: {
Line 104: throw ex;
Line 105: }
Line 106: }
I wanted to show me a sale = 0 if the record doesn't exist. Thanks for any help.
Reply
Answers (
3
)
Update existing dll base on Database
See Details by Employee Code.