User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 456,530 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,779 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 5930 | Replies: 1
Reply
Join Date: Aug 2007
Posts: 10
Reputation: sasikala123 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
sasikala123 sasikala123 is offline Offline
Newbie Poster

Help how to check the null condition in c#?

  #1  
Oct 9th, 2007
Hello Everyone,

In my sql database I am having a country field and a State field with some values and also some null values and I am populating the country values into a dropdown list box in the frontend using database connection

e.g.
Country
India
Indonesia
null
Iran

My requirement is, if I select the particular country in the dropdown list box, I need to display the rspctive state assigned to it, If I select the null value, all the state and country should be displayed. I need the coding for the above null condition in c#.

Thanks
Sasikala
Last edited by sasikala123 : Oct 9th, 2007 at 3:45 am.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,166
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Rep Power: 7
Solved Threads: 59
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: how to check the null condition in c#?

  #2  
Oct 9th, 2007
I'm not certain of what you require. But perhaps you need DBNull.Value this represents a null database value. For example you can comapare a value in a DataSet to DBNull.Value which returns true if the value is null.

if(myDataSet.Rows[0]["columnName"] == DBNull.Value)
         //the value is null.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 4:24 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC