not a valid month

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jestin
    New Member
    • Mar 2008
    • 12

    not a valid month

    hi friends i am trying to insert some values with date and time to Oracle db.

    and the ASP code is as follows

    sqlinsert="INSE RT INTO Tbl_RequestInfo (" &_
    "ReqHouseno , " &_
    "ReqBadgeno , " &_
    "ReqRschedD ate, " &_
    "ReqCompletiond ateest," &_
    "ReqJobServices , " &_
    "ReqStatus, " &_
    "ReqCalldat e, " &_
    "ReqScheduledda te)values
    values (" &_
    STR_Quote2(Repl aceQuote(textHo useNo)) & ", " &_
    STR_Quote2(Repl aceQuote(textBa dgeNo)) & ", " &_
    DateDelimiter(F ormatDateTime(s date,2)) & ", " &_
    STR_Quote2(Repl aceQuote(textco mpletiondateest )) & ", " &_
    STR_Quote2(Repl aceQuote("Pendi ng")) & ", " &_
    STR_Quote2(Repl aceQuote(sessio n("calldate") )) & ", " &_
    DateDelimiter(F ormatDateTime(N ow())) & ", " &_
    DateDelimiter(F ormatDateTime(N ow())) & ")

    MMToConn.execut e sqlinsert, recordaffected, 1

    and i am getting values as follows

    INSERT INTO Tbl_RequestInfo (ReqHouseno, ReqBadgeno, ReqRschedDate, ReqCompletionda teest,ReqJobSer vices, ReqStatus, ReqCalldate, ReqScheduleddat e) values ('smmn725', '216322', '4/1/2008', '4/1/2008 3:59:00 PM', 'Pending', '4/1/2008 10:14:11 AM', '4/1/2008 10:14:11 AM', '4/1/2008 10:14:11 AM')

    and error as not a valid month

    can any one tell whts the problem?
    thx
  • shweta123
    Recognized Expert Contributor
    • Nov 2006
    • 692

    #2
    Hi,

    For inserting Date value into the table using Oracle database you should first convert the date value using To_Date function. This is the syntax for doing the conversion to Date :

    TO_DATE(strdate )

    e.g. In order to remove the error you have to write it like this :

    Code:
    sqlinsert="INSERT INTO Tbl_RequestInfo (" &_
    "ReqHouseno, " &_
    "ReqBadgeno, " &_
    "ReqRschedDate, " &_
    "ReqCompletiondateest," &_
    "ReqJobServices, " &_
    "ReqStatus, " &_
    "ReqCalldate, " &_
    "ReqScheduleddate)values
    values (" &_
    STR_Quote2(ReplaceQuote(textHouseNo)) & ", " &_
    STR_Quote2(ReplaceQuote(textBadgeNo)) & ", " &_
    DateDelimiter(FormatDateTime(sdate,2)) & ", " &_
    STR_Quote2(ReplaceQuote(textcompletiondateest)) & ", " &_
    STR_Quote2(ReplaceQuote("Pending")) & ", " &_
    STR_Quote2(ReplaceQuote(session("calldate"))) & ", " &_
    DateDelimiter(To_Date(FormatDateTime(Now()))) & ", " &_
    DateDelimiter(TO_Date(FormatDateTime(Now()))) & ")



    Originally posted by jestin
    hi friends i am trying to insert some values with date and time to Oracle db.

    and the ASP code is as follows

    sqlinsert="INSE RT INTO Tbl_RequestInfo (" &_
    "ReqHouseno , " &_
    "ReqBadgeno , " &_
    "ReqRschedD ate, " &_
    "ReqCompletiond ateest," &_
    "ReqJobServices , " &_
    "ReqStatus, " &_
    "ReqCalldat e, " &_
    "ReqScheduledda te)values
    values (" &_
    STR_Quote2(Repl aceQuote(textHo useNo)) & ", " &_
    STR_Quote2(Repl aceQuote(textBa dgeNo)) & ", " &_
    DateDelimiter(F ormatDateTime(s date,2)) & ", " &_
    STR_Quote2(Repl aceQuote(textco mpletiondateest )) & ", " &_
    STR_Quote2(Repl aceQuote("Pendi ng")) & ", " &_
    STR_Quote2(Repl aceQuote(sessio n("calldate") )) & ", " &_
    DateDelimiter(F ormatDateTime(N ow())) & ", " &_
    DateDelimiter(F ormatDateTime(N ow())) & ")

    MMToConn.execut e sqlinsert, recordaffected, 1

    and i am getting values as follows

    INSERT INTO Tbl_RequestInfo (ReqHouseno, ReqBadgeno, ReqRschedDate, ReqCompletionda teest,ReqJobSer vices, ReqStatus, ReqCalldate, ReqScheduleddat e) values ('smmn725', '216322', '4/1/2008', '4/1/2008 3:59:00 PM', 'Pending', '4/1/2008 10:14:11 AM', '4/1/2008 10:14:11 AM', '4/1/2008 10:14:11 AM')

    and error as not a valid month

    can any one tell whts the problem?
    thx

    Comment

    Working...