Click here to Skip to main content
15,923,051 members
Home / Discussions / C#
   

C#

 
Generalimportant coding problem Pin
snouto19-Aug-05 0:53
snouto19-Aug-05 0:53 
GeneralRe: important coding problem Pin
Corinna John19-Aug-05 1:32
Corinna John19-Aug-05 1:32 
GeneralRe: important coding problem Pin
miah alom19-Aug-05 4:34
miah alom19-Aug-05 4:34 
GeneralRe: important coding problem Pin
Corinna John19-Aug-05 5:16
Corinna John19-Aug-05 5:16 
GeneralCancel closing a form Pin
bouli19-Aug-05 0:06
bouli19-Aug-05 0:06 
GeneralRe: Cancel closing a form Pin
Azerax19-Aug-05 1:05
Azerax19-Aug-05 1:05 
GeneralRe: Cancel closing a form Pin
bouli19-Aug-05 1:19
bouli19-Aug-05 1:19 
GeneralCannot get value because it is DBNull Pin
beqs18-Aug-05 23:47
beqs18-Aug-05 23:47 
Hi,

I am using a database. And return the data to a DataSet dsPlayers. Some players have a birthday, which is a DateTime field, and some do not. These have no value so it says <null>. I want to put their birthday to a DateTimePicker dtpBirthday, but when it is <null> I want to give the DateTimePicker the value DateTime.Now.

I have the following code, which is noit working for me.

<br />
if (dsPlayer.Players[0].BirthDay.ToString() == null)<br />
{<br />
dtpBirthday.Value = DateTime.Now;<br />
}<br />
else<br />
{<br />
dtpBirthday.Value = dsPlayer.Players[0].BirthDay;<br />
}<br />


What is the best way to make this if statement?
GeneralRe: Cannot get value because it is DBNull Pin
Guffa18-Aug-05 23:53
Guffa18-Aug-05 23:53 
GeneralRe: Cannot get value because it is DBNull Pin
Anonymous19-Aug-05 0:39
Anonymous19-Aug-05 0:39 
GeneralRe: Cannot get value because it is DBNull Pin
Guffa19-Aug-05 0:51
Guffa19-Aug-05 0:51 
GeneralRe: Cannot get value because it is DBNull Pin
Anonymous19-Aug-05 1:31
Anonymous19-Aug-05 1:31 
GeneralRe: Cannot get value because it is DBNull Pin
Azerax19-Aug-05 0:50
Azerax19-Aug-05 0:50 
GeneralRe: Cannot get value because it is DBNull Pin
Anonymous19-Aug-05 1:21
Anonymous19-Aug-05 1:21 
GeneralRe: Cannot get value because it is DBNull Pin
Azerax19-Aug-05 2:37
Azerax19-Aug-05 2:37 
GeneralRe: Cannot get value because it is DBNull Pin
Azerax19-Aug-05 2:41
Azerax19-Aug-05 2:41 
GeneralBoxing/unboxing objects Pin
JorisFromHolland18-Aug-05 22:08
JorisFromHolland18-Aug-05 22:08 
GeneralRe: Boxing/unboxing objects Pin
Guffa18-Aug-05 22:16
Guffa18-Aug-05 22:16 
GeneralRe: Boxing/unboxing objects Pin
Matt Gerrans18-Aug-05 22:29
Matt Gerrans18-Aug-05 22:29 
GeneralComparing strings Pin
binglin18-Aug-05 22:06
binglin18-Aug-05 22:06 
GeneralRe: Comparing strings Pin
Gavin Jeffrey18-Aug-05 22:13
Gavin Jeffrey18-Aug-05 22:13 
GeneralRe: Comparing strings Pin
Mohamad Al Husseiny18-Aug-05 22:21
Mohamad Al Husseiny18-Aug-05 22:21 
GeneralRe: Comparing strings Pin
Guffa18-Aug-05 22:38
Guffa18-Aug-05 22:38 
GeneralRe: Comparing strings Pin
Mohamad Al Husseiny18-Aug-05 22:51
Mohamad Al Husseiny18-Aug-05 22:51 
GeneralWebservice Pin
WDI18-Aug-05 20:44
WDI18-Aug-05 20:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.