Code Simplified – Viral Sarvaiya

Code Simplified – Viral Sarvaiya, Web Developer Friends, dot net Developer, Sql Server Developer

Posts Tagged ‘datetime null’

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

Posted by Viral Sarvaiya on December 29, 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);

with this procedure you can insert the NULL value in datetime datatype column.

enjoy coding….

Posted in ASP.NET | Tagged: , , , , | 2 Comments »

 
Follow

Get every new post delivered to your Inbox.

Join 44 other followers

%d bloggers like this: