Results 1 to 2 of 2

Thread: Updating date field in SQL

  1. #1

    Thread Starter
    Addicted Member Michel Jr's Avatar
    Join Date
    Jan 2000
    Location
    Brazil
    Posts
    175

    Question

    Hi,

    I'm getting crazy with such simple thing...

    I'm using:

    wdate = Format(MskDate.Text, "dd/mm/yyyy")

    wSQL = "UPDATE Customers SET DateExp=" & wdate & " WHERE CodeUser='TEST'"

    but it records the date in my table as "01/01/1900"

    Why?

    I also tryed to use # in the update statement, but no success...

    -----------------------------------------------------------------------

    I also tryed:

    MskDate.Text = "15/10/2002"

    wSQL = "Update CUSTOMERS Set DateExp = MskDate.Text Where CodeUser='TEST'"

    This is the error message:
    "The conversion of char data type to smalldatetime data type resulted in a out-of-range smalldatetime value"
    -----------------------------------------------------------------------

    Note: I'm using SQL 7 and smalldatetime data type.


    Thanks for any help...

    Michel Junior

  2. #2
    Lively Member
    Join Date
    Mar 2001
    Location
    Brighton, England
    Posts
    112

    Smile

    Michel,
    do you really need to store the date in that format within the db??, or are you going to retreive the date later and use it in your code??. I just store dates as date/time data types and then when I retrieve them from the db I format them before I put them into my controls.

    john

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