Inserting Dates & Times from ASP into SQL 7

Results 1 to 2 of 2

Thread: Inserting Dates & Times from ASP into SQL 7

  1. #1
    Abel Guest

    Default Inserting Dates & Times from ASP into SQL 7

    Hi there, I wish to insert a date + time value into my SQL server DB, through a DSNless connection from an ASP page.<BR><BR>Now, the date looks like this on my ASP page:<BR><BR>31/01/2001 14:45:00<BR>dd/mm/yyyy hh:mm:ss<BR><BR>fine, ASP can use this date, compare it, do everything you would expect. When I try and insert it into a database (between &#039;&#039;s) I get a data type mismatch error, trying to squish a string into a date field.<BR><BR>How can I get the full date/time into the db? I can format it to fit, but that loses the time part!<BR><BR>I am using the data type datetime in SQL and the formatdatetime(x,0) type in ASP, am I doing something wrong there? If I reformat in ASP as formatdatetime(x,2) it comes out as "26 January 2001" but fits into the DB with format "26/01/2001" !!<BR><BR>I&#039;m sure this is easy, but I can&#039;t see the wood for the trees.<BR><BR>When I format in ASP to type &#039;2&#039;, do I actually really lose the time? or is it there?<BR><BR>Cheers,<BR>a *confused* Abel<BR><BR><BR>

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default RE: Inserting Dates & Times from ASP into SQL 7

    You are trying to insert the date in the dd/mm/ccyy format but your SQL server maybe looking for mm/dd//ccyy format.<BR><BR>Just change the format and see if it works...if it does then you know what your problem is.<BR>

Posting Permissions

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