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
monika
NA
1
0
reading null values in dataset
Nov 27 2008 1:02 AM
I have to read a database using dataset. My database has some null values.
My code is working fine when there is a value in the database. But when there is a null value in the database, dataset throws an exception.
I have to read null value in a variable. I have tried this....
if (dr["value"] != DBNull.Value)
{
abc = Convert.ToDouble(dr["value"]);
MessageBox.Show("value is:" + abc.ToString());
}
else
{
abc=null;
MessageBox.Show("value is:" + abc.ToString());
}
But it gives an error that null can not be assigned to a double variable(here abc is a double variable). How can I read a null value in a variable.
Can anybody guide me....
Reply
Answers (
2
)
lock database sql2005
How to convert varchar or nvarchar to varbinary in SQL Server 2005?