Link to home
Start Free TrialLog in
Avatar of MrKevorkian
MrKevorkian

asked on

check if a DataRow cell is null

i want to check if a datarow cell has anything in it.

if it is null - i will put a string.empty into it(i think this is best)

i am doing this so i can just populate a address object without worrying if it will break because the data cell is null.

my code which didnt work is:
//check address for nulls

if (dr["Postcode"] = null)
{
dr["Postcode"] = s;
}
Avatar of Mohammad Aamir Qureshi
Mohammad Aamir Qureshi
Flag of Australia image

plz give me more explanation
Avatar of MrKevorkian
MrKevorkian

ASKER

i collect a dataset from the db.

i want a way of checking if its datarows contents contain any data or if they are null

if they are null then just assign a default empty string

 
ASKER CERTIFIED SOLUTION
Avatar of Agarici
Agarici
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial