display data from tables that contain a null value
Posted
by
user2631662
on Stack Overflow
See other posts from Stack Overflow
or by user2631662
Published on 2013-11-07T13:21:05Z
Indexed on
2013/11/07
15:54 UTC
Read the original article
Hit count: 121
c#
I need the code below to say - if myReader reads a null entry a new method is called. At the moment it will not display data from tables that contain a null value
conDataBase.Open();
myReader = cmdDataBase.ExecuteReader();
while (myReader.Read())
{
if (myReader["Code_CodeID"] != DBNull.Value)
{
string sFirst = myReader["First"].ToString();
string sLast = myReader["Last"].ToString();
string sAdd1 = myReader["Address1"].ToString();
string sCode = myReader["Code"].ToString();
txtFirst.Text = sFirst;
txtSecond.Text = sLast;
txtadd1.Text = sAdd1;
txtDeviceIMEI.Text = sCode;
}
}
}
else
{
//go to a new method
}
}
© Stack Overflow or respective owner