Results 1 to 2 of 2

Thread: [RESOLVED] SQL Server Date Insertion Error

  1. #1

    Thread Starter
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Resolved [RESOLVED] SQL Server Date Insertion Error

    Hello,
    i have a sql server table where the date field in the table is set to smalldatetime.

    i get an error when i try to insert Date.Now() into the field.

    When i use Date.Today() to insert the date in the field sets itself to 01/01/1900
    even thought the day is todays date.

    why is the date setting itself to 01/01/1900

    also why cant i insert a full date and time into the small datetime field
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  2. #2
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861

    Re: SQL Server Date Insertion Error

    Try
    VB Code:
    1. FormatDateTime(DateTime.Now, DateFormat.ShortDate)
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width