Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

condistion

Status
Not open for further replies.

fmardani

Programmer
Jul 24, 2003
152
I would like to check for a field if it is null so that I don't get an error while populating data.
This is what I am using. It does not work. Can u c why please? thanks
lblArrivaltime.Text = (oDR["ArrivalTime"].ToString() == null) ? "" : oDR["ArrivalTime"].ToString();
 
I always do an isnull(field,value if null) on the database call....

then I don't have to worry about nulls in my program...

dlc
 
Code:
lblArrivaltime.Text = (oDR["ArrivalTime"] == DBNull.Value ? "" : oDR["ArrivalTime"].ToString());

-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top