How to format a date from a form for SQL server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dsmith76
    New Member
    • Dec 2011
    • 5

    How to format a date from a form for SQL server

    I have retrieved a date from a form and the
    Request.form("D OB") gives me the format of: 12/04/1976.

    When I try to use SQL to add the record to the database, I get the error below.

    Microsoft OLE DB Provider for SQL Server error '80004005'

    Arithmetic overflow error converting expression to data type datetime.

    The code generating the error is below:
    oRs.Open "MailList", oC, adOpenKeySet, adLockPessimist ic, adCmdTable

    ' Add a new record
    oRs.AddNew
    oRs("DOB")= DOB
    ' Update the record
    oRs.Update

    I need to know how to format the date variable so the database can be updated.
    Thanks,
    Dave
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Your date value is valid as far as your front-end app is concern. Check the setting of your server if it's set to accept a mm/dd/yyyy formatted date. If all seems well, then you have another problematic column, not the DOB.

    Happy Coding!!!


    ~~ CK

    Comment

    Working...