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
PankaJ D
NA
154
0
How to checkNull values using Execute Scalar
Feb 17 2011 12:26 AM
string strmcat = "select idcategory from categories where categorydesc='" + mcategory + "'";
SqlCommand com = new SqlCommand(strmcat, conn);
conn.Open();
Object o = (Object)com.ExecuteScalar();
if ( o != DBNull.Value)
{
idmcat = (int)com.ExecuteScalar();
}
conn.Close();
What wrong with this code.When null values return from db then also control goes in if condition.
Reply
Answers (
3
)
Update to XML using DataGridView (LINQ)
How to generate a group of file names in SQL?