Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004

    Unanswered: Date data type-Conversion Error.

    Dear friends,

    I am struggling to insert a date value in "dd-mm-yyyy" format to SQL server table having datatype as Date/Time.

    Regional date setting for Server and Local systems are in dd-mm-yyyy format.

    I am using following code

    Dim DT As String
    DT = Now()
    DT = Format(DT, "MM/DD/YYYY")

    for the inserting into table using command

    ins_comm.CommandText = " INSERT INTO CARD (doe) values("& DT &")"

    Procedure will end without any error ,but stored value for the date feild will be garbage value like 1900-01-01.

    But if i used mm-dd-yyyy format ,it will get inserted.

    What could be the reason,How I can save value in dd-mm-yyyy or dd-mm-yy format

    Please help!!!

    Graceson Mathew

  2. #2
    Join Date
    Jul 2003
    Try using the CONVERT function instead, look it up in BOL and select the style that suits you best.

Posting Permissions

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