Checking for null value?

Hello all.  How do I ensure that if a dataset field is null I dont want to try and set it?  I thought it was just != null but that is not working.  However, I could swear that works in the later frameworks.  In 1.1 I have the following which the field is null but it still gets into the next line of code:

if (dsOrderDetail.Tables[0].Rows[0]["OrderTotal"] != null)
{  //field is null but it still gets into this code
}
sbornstein2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jaime OlivaresSoftware ArchitectCommented:
you can do as:

if (!Convert.IsDBNull(dsOrderDetail.Tables[0].Rows[0]["OrderTotal"])
{
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AUmidhCommented:
if (equals(dsOrderDetail.Tables[0].Rows[0]["OrderTotal"],Dbnull.value)!=true)
{  
}
0
sbornstein2Author Commented:
do you know if what I had here works possibly in the later versions?
0
Rahul Goel ITILSenior Consultant - DeloitteCommented:
if (!Convert.IsDBNull(dsOrderDetail.Tables[0].Rows[0]["OrderTotal"])
{
}
0
Jaime OlivaresSoftware ArchitectCommented:
@Rahu,
have you read the previous answers?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.