How To pass A null Value in database...

Posted by Rock_Monu under Sql Server on 10/17/2013 | Points: 10 | Views : 986 | Status : [Member] | Replies : 4
How To pass A null Value in database From Datetimepicker In Windows Form In C#.
Please Give Proper solution..Urgently.....!!!!!!!




Responses

Posted by: Bandi on: 10/18/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Refer
http://blogs.interknowlogy.com/2007/01/21/winforms-databinding-datetimepicker-to-a-nullable-type/

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Rock_Monu, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ermahesh2009 on: 10/18/2013 [Member] Starter | Points: 25

Up
0
Down
while passing parameter to stored procedure or query set its value to nothing

like parameter is @docdate

@docdate = noting

Rock_Monu, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nismeh on: 10/18/2013 [Member] Starter | Points: 25

Up
0
Down
Hi,

If you are using C# and want to pass null value as parameter. You can use DBNull in this case. And if you are firing query directly to sql server than you can use Null key word

IT KNOWLEDGE IS APPLIED KNOWLEDGE
So Just Do It

Rock_Monu, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 10/18/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Refer this link..
http://www.codeproject.com/Articles/5428/Nullable-DateTimePicker

Tell us which value is stored into Database if the DateTimePicker value is NULL...
I think some default value will get into Database...
For suppose the Default value is '01-01-1900' then you can replace that default value with NULL by using NULLIF() function
Notice that I took default value as '01-01-1900'
SELECT NULLIF(yourDateColumn, '01-01-1900')  -- returns NULL


Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Rock_Monu, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response