Hello Gourav,

I read again your sample code snippets:

iii) SqlDateTime sqldatenull ;
     SqlDateTime sqldatenull ;
     cmd.Parameters ["@Date"].Value =sqldatenull ;

The  variable sqldatenull must be assigned like this:

sqldatenull = SqlDateTime.Null;


before using it like this:

cmd.Parameters ["@Date"].Value =sqldatenull ;


Here is a reference for you:
http://www.c-sharpcorner.com/UploadFile/sd_patel/EnterNullValuesForDateTime11222005015742AM/EnterNullValuesForDateTime.aspx



Regards,


Benj







On Feb 4, 7:17 pm, Gourav vishnoi <[email protected]> wrote:
> Thanks All,
>
> @Benj I am using Sql Server 2008.
> @processor  ya i tried using dbnull also but it didn't work.
>
>
>
> On Fri, Feb 4, 2011 at 4:26 PM, Benj Nunez <[email protected]> wrote:
> > May I ask what database are you using?
>
> > Is it Mysql? Sql Server? DB2? MS Access?
>
> > Regards,
>
> > Benj
>
> > On Feb 4, 1:34 am, Gourav <[email protected]> wrote:
> > > Hi All,
> > > I am creating a panel in which User hav to enter His Professional
> > > Working Experience
> > > There is Date of Joinning is Mandatory but date of Resignation is
> > > optional..So here i am facing problem to send NULL value in Database..
> > > In database my Datatype is DATETIME
> > > I already used many type but i didn't get solution.:
>
> > > i). DateTime dt = new DateTime();
> > >     dt = null;
> > > ii)  string stringTest = null;
> > >     DateTime dateTimeTest = null;
> > > iii) SqlDateTime sqldatenull ;
> > >      SqlDateTime sqldatenull ;
> > >      cmd.Parameters ["@Date"].Value =sqldatenull ;
> > > iv) System.DBNull.Value
> > > v)
> > > .
> > > .
> > > .
>
> > > No one is handle to this situation..SO pls tell me how to handle this
> > > problem.I'll wait for ur reply and Thanks in advanced for your
> > > fantabulous  answers...
>
> --
> Warm Regards :-
> Gourav Vishnoi
> +91-9871157845 ( M )

Reply via email to