Null Dates

Discussion in 'ASP .Net' started by Craig Buchanan, Oct 14, 2003.

  1. I have a custom class that has a property defined as a Date. If the
    property is not set in the UI, the property's value is "12:00:00AM".

    This cause problems when I try to insert or update this data in SQL Server
    2000, via a stored procedure. SQL indicates that it isn't a valid date
    (rightly so).

    As a solution, I've changed the property to be an Object.

    What I really need is a Null Date. Is there a more elegant solution?

    Thanks,

    Craig Buchanan
     
    Craig Buchanan, Oct 14, 2003
    #1
    1. Advertisements

  2. Check out
    http://www.c-sharpcorner.com/Code/2003/Sept/EnterNullValuesForDateTime.asp
    See if you can manipulate with the code in similar manner

    "Craig Buchanan" <> wrote in message
    news:e8A0$...
    > I have a custom class that has a property defined as a Date. If the
    > property is not set in the UI, the property's value is "12:00:00AM".
    >
    > This cause problems when I try to insert or update this data in SQL Server
    > 2000, via a stored procedure. SQL indicates that it isn't a valid date
    > (rightly so).
    >
    > As a solution, I've changed the property to be an Object.
    >
    > What I really need is a Null Date. Is there a more elegant solution?
    >
    > Thanks,
    >
    > Craig Buchanan
    >
    >
     
    Sonali.NET[MVP], Oct 14, 2003
    #2
    1. Advertisements

  3. Craig Buchanan

    mikeb Guest

    Craig Buchanan wrote:
    > I have a custom class that has a property defined as a Date. If the
    > property is not set in the UI, the property's value is "12:00:00AM".
    >
    > This cause problems when I try to insert or update this data in SQL Server
    > 2000, via a stored procedure. SQL indicates that it isn't a valid date
    > (rightly so).
    >
    > As a solution, I've changed the property to be an Object.
    >
    > What I really need is a Null Date. Is there a more elegant solution?
    >
    > Thanks,
    >
    > Craig Buchanan
    >
    >


    System.Data.SqlTypes.SqlDateTime

    --
    mikeb
     
    mikeb, Oct 14, 2003
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Lozzi

    Null Dates are not 1/1/1900

    David Lozzi, May 18, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    16,733
    Kevin Spencer
    May 19, 2005
  2. Rookie Card
    Replies:
    1
    Views:
    1,660
    Daniel Fisher\(lennybacon\)
    Aug 5, 2005
  3. David Lozzi

    Dates dates dates dates... SQL and ASP.NET

    David Lozzi, Sep 29, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    1,080
    Rob Schieber
    Sep 30, 2005
  4. Replies:
    5
    Views:
    30,333
    Mike Schilling
    Mar 29, 2006
  5. PW

    Dates! Dates! Dates!

    PW, Aug 7, 2004, in forum: ASP General
    Replies:
    4
    Views:
    494
    Mark Schupp
    Aug 9, 2004
  6. Replies:
    1
    Views:
    381
    Jano Svitok
    Jul 17, 2007
  7. kellygreer1

    RFC-822 dates into Ruby dates

    kellygreer1, Jun 8, 2008, in forum: Ruby
    Replies:
    1
    Views:
    466
    Eric I.
    Jun 8, 2008
  8. Dr J R Stockton

    FAQ Dates; Opera Dates.

    Dr J R Stockton, Jun 18, 2007, in forum: Javascript
    Replies:
    0
    Views:
    309
    Dr J R Stockton
    Jun 18, 2007
Loading...