#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    3
    Rep Power
    0

    problem in updating data type for datetime


    i'm really frustrated in this coding which is seems no problem for but got error.

    The asp coding is like below:

    sqlstmt = "UPDATE tDoc_Reviewer SET Reviewer_Status='" & Request("optReview_Status") & "', " &_
    "Spec_Update='" & Request("optUpdate") & "', " &_
    "Factory_ECN#='" & Request("txtFactory_ECN#") & "', " &_
    "Others_Comment='" & Request("txtComments") & "', " &_
    "Date_Review ='" & Now & "' " &_
    "WHERE CSRS_recid='" & Session("kRec_id") & "'" &_
    "AND Reviewer_Name='" & Session("Username") & "'"

    and after i add the response.write to it, it's output is :

    UPDATE tDoc_Reviewer SET Reviewer_Status='Agree', Spec_Update='Yes', Factory_ECN#='', Others_Comment='testing', Date_Review ='1/28/04 8:16:20 AM' WHERE CSRS_recid='979'AND Reviewer_Name='user1'


    and the error comes out like this:

    Microsoft OLE DB Provider for SQL Server error '80040e07'

    The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

    /doccon/custspec/Review.asp, line 28


    line 28 of course is:

    rs.open sqlstmt, DataConn


    I have tried so many times with other method still the same error. So i ask for u guys Please help me to take a look for me. Thanks
  2. #2
  3. I thank you very little
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2003
    Location
    Milwaukee, WI
    Posts
    1,028
    Rep Power
    18
    What are the Database types for these?
  4. #3
  5. Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Location
    Boston, MA, USA
    Posts
    23
    Rep Power
    0

    date field


    try changing Now() to Date()
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    3
    Rep Power
    0
    thanks for u guys' responses

    actually i use sql server 2000 for this database

    i had tried to use date(), it also keep coming out the same error.

    but after that i changed the data field to varchar then only it can be updated.

    thanks guys.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    1
    Rep Power
    0

    problem in updating data type for datetime Reply to Thread


    I have this problem regarding the datetime datatype.

    I dunno what happened to the code as it is working prefectly fine in all the IIS system except one where I have am hosting.

    The code is to insert now() into the column date with datatype of datetime.

    This was the error msg I get in return:

    Microsoft OLE DB Provider for ODBC Drivers error '80040e07' [Microsoft][ODBC SQL Server Driver][SQL Server]The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

    swcr/softwarecr.asp, line 92

    As I tested the code by installing in some other machines its working fine but facing problem for a specific machine where I have to HOST

    Can any one help me out with this as i feel there is nothing wrong with the code but may be some setting with the server where I am hosting
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2004
    Posts
    371
    Rep Power
    15
    Hi Koese,

    The problem could be because of the date format.

    Eg: If u give the date in dd/mm/yyyy format ms sql might consider it as mm/dd/yyyy. In that case if ur input is 20/01/2004 it will have problem. So try giving the date in dd/mon/yyyy ie 20/jan/2004.
    Regards,
    Brightlight

IMN logo majestic logo threadwatch logo seochat tools logo