Results 1 to 8 of 8
  1. #1
    ABW Ambassador kse's Avatar
    Join Date
    November 29th, 2005
    Posts
    2,511
    Question Added Date to MySQL Database using asp
    I have a older site that uses asp clasic and I want to pass a date to a mysql database. In the below example "New_EndDate" does not get added to my database but the other three fields gets added including the date that is hard coded in Insert line.

    Any ideas???



    <%
    Dim sConnection, objConn , objRS
    sConnection = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=mysq.xxx.com; DATABASE=coupons; UID=myuser;PASSWORD=mypassword; OPTION=3"
    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.Open(sConnection)
    Dim New_EndDate
    New_EndDate = "2009-11-01"
    New_MerchantName = "Test Merchant"
    New_CouponDetails = "Sample coupon details"
    CouponLink = "CouponSite.com"
    Set objRS = objConn.Execute("INSERT INTO coupons (StartDate, EndDate, MerchantName, CouponDetails ) VALUES ('2009-10-01', 'New_EndDate', 'New_MerchantName', 'New_CouponDetails' )")
    objRS.Close
    Set objRS = Nothing
    objConn.Close
    Set objConn = Nothing
    %>
    MERCHANTS: Start showing your coupons directly on your site, that way your shoppers will stop leaving your site looking for them!! If not then remove your Coupon Box!!

  2. #2
    Grandma broke her coccyx! Uncle Rico's Avatar
    Join Date
    May 8th, 2007
    Location
    North Carolina
    Posts
    2,238
    What is the format/type of the field "EndDate" in your database table?

  3. #3
    ABW Ambassador kse's Avatar
    Join Date
    November 29th, 2005
    Posts
    2,511
    It is datetime (for both StartDate & EndDate) I have also tried just date
    MERCHANTS: Start showing your coupons directly on your site, that way your shoppers will stop leaving your site looking for them!! If not then remove your Coupon Box!!

  4. #4
    Grandma broke her coccyx! Uncle Rico's Avatar
    Join Date
    May 8th, 2007
    Location
    North Carolina
    Posts
    2,238
    After the insert, is EndDate blank or does it have 0's in it?

  5. #5
    ABW Ambassador kse's Avatar
    Join Date
    November 29th, 2005
    Posts
    2,511
    all Zero's

    0000-00-00 00:00:00
    MERCHANTS: Start showing your coupons directly on your site, that way your shoppers will stop leaving your site looking for them!! If not then remove your Coupon Box!!

  6. #6
    Grandma broke her coccyx! Uncle Rico's Avatar
    Join Date
    May 8th, 2007
    Location
    North Carolina
    Posts
    2,238
    Change...
    New_EndDate = "2009-11-01"

    to...
    New_EndDate = "2009-11-01 11:59:59"

    and re-run the script

  7. #7
    ABW Ambassador kse's Avatar
    Join Date
    November 29th, 2005
    Posts
    2,511
    its still all Zero's

    0000-00-00 00:00:00

    Here are the record types for the database:

    Type - datetime
    Collation - is blank (My text Collation value are utf8_general_ci)
    MERCHANTS: Start showing your coupons directly on your site, that way your shoppers will stop leaving your site looking for them!! If not then remove your Coupon Box!!

  8. #8
    ABW Ambassador kse's Avatar
    Join Date
    November 29th, 2005
    Posts
    2,511
    Just figured it out after some seaching on Google, Thanks SeymourButts for helping me on this. I had to add '"& &"' around the value I was sending to the database.


    Set objRS = objConn.Execute("INSERT INTO coupons (StartDate, EndDate, MerchantName, CouponDetails ) VALUES ('"&New_StartDate&"', '"&New_EndDate&"', '"&New_MerchantName&"', '"&New_CouponDetails&"' )")
    MERCHANTS: Start showing your coupons directly on your site, that way your shoppers will stop leaving your site looking for them!! If not then remove your Coupon Box!!

  9. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. So i've got the datafeed into mysql database..
    By chillini in forum Programming / Datafeeds / Tools
    Replies: 10
    Last Post: December 2nd, 2008, 02:06 PM
  2. ASP - problem with database connectivity
    By akinak in forum Programming / Datafeeds / Tools
    Replies: 29
    Last Post: November 24th, 2008, 01:21 PM
  3. Database Replication with mySQL
    By Snib in forum Programming / Datafeeds / Tools
    Replies: 10
    Last Post: September 8th, 2006, 01:24 AM
  4. How can I use buyitbomb with Mysql database?
    By Amavisca in forum Programming / Datafeeds / Tools
    Replies: 0
    Last Post: July 6th, 2005, 06:43 AM
  5. MySQL database - Can I...
    By ~Michelle in forum Programming / Datafeeds / Tools
    Replies: 2
    Last Post: March 26th, 2004, 01:59 PM

Posting Permissions

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