Bharath Radhekrishna

Insert Null values into datetime column of SQL SERVER using asp.net,C#

Posted by: onetidbit on: March 26, 2009

Sometimes we will get the situation where we must insert NULL into datetime column in sql server.

Follow these steps to do that:

1) First Include the namespace:

using System.Data.SqlTypes;

2)  Declare

System.Data.SqlTypes.SqlDateTime getDate;
getDate = SqlDateTime.Null;

3) Insert using command Parameters

cmd11.Parameters.AddWithValue(“@encashed_date”, getDate);

——————————<>—————————————

5 Responses to "Insert Null values into datetime column of SQL SERVER using asp.net,C#"

thx a million..was really looking for this ..thx a lot.

really thx on me . i was searching for long time

thank you it worked a loot for me . pls can you suggest topics in asp where to concentrate i am fresher and i search of job

Great job dude..

i tried this, but still getting error. :(

Leave a Reply