Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Dec 2004
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with these queries

    his is written for a SQL Server, but I am tryign to use the application with Access databse. But the query are slighlty different. It keeps giving me a data mis-match error.

    Here is the current sql stament how do I re-write it for Access. I keep getting an error at conn.execute.(sql)

    sql = "insert into [plan] (name, price, [desc], feature_post_profile, feature_view_profile, feature_upload_photo, feature_upload_video, feature_upload_audio, feature_quick_search, feature_detailed_search, feature_save_search, feature_add_favorites, feature_send_messages, feature_receive_messages, feature_chat, feature_more_photo, paypal, length) values ('" & name & "', " & price & ", '" & desc & "', '" & feature_post_profile & "', '" & feature_view_profile & "', '" & feature_upload_photo & "', '" & feature_upload_video & "', '" & feature_upload_audio & "', '" & feature_quick_search & "', '" & feature_detailed_search & "', '" & feature_save_search & "', '" & feature_add_favorites & "', '" & feature_send_messages & "', '" & feature_receive_messages & "', '" & feature_chat & "', '" & feature_more_photo & "', '" & paypal & "', '" & length & "')"

    conn.execute(sql)
    end function

    function ModifyPlan(plan_id, name, price, desc, feature_post_profile, feature_view_profile, feature_upload_photo, feature_upload_video, feature_upload_audio, feature_quick_search, feature_detailed_search, feature_save_search, feature_add_favorites, feature_send_messages, feature_receive_messages, feature_chat, feature_more_photo, paypal, length)

    sql = "update [plan] set name='" & name & "', price=" & price & ", [desc]='" & desc & "', feature_post_profile='" & feature_post_profile & "', feature_view_profile='" & feature_view_profile & "', feature_upload_photo='" & feature_upload_photo & "', feature_upload_video='" & feature_upload_video & "', feature_upload_audio='" & feature_upload_audio & "', feature_quick_search='" & feature_quick_search & "', feature_detailed_search='" & feature_detailed_search & "', feature_save_search='" & feature_save_search & "', feature_add_favorites='" & feature_add_favorites & "', feature_send_messages='" & feature_send_messages & "', feature_receive_messages='" & feature_receive_messages & "', feature_chat='" & feature_chat & "', feature_more_photo='" & feature_more_photo & "', paypal='" & paypal & "', length='" & length & "' where plan_id=" & plan_id

    conn.execute(sql)

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    Texas
    Posts
    287
    Thanks
    0
    Thanked 0 Times in 0 Posts
    instead of executing the sql, try doing a response.write sql
    and see what you actually have.....format it so that it is readable and check to be sure all expected values are there....
    then cut and paste and try to run the sql directly in Access.


    fv

  • #3
    New Coder
    Join Date
    Dec 2004
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I did that and this is the error I keep getting.

    Microsoft JET Database Engine (0x80040E07)
    Data type mismatch in criteria expression.
    /ashanti/include/plan.asp, line 13

  • #4
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    like this
    Code:
    sql = "insert into [plan] (name, price, [desc], feature_post_profile, feature_view_profile, feature_upload_photo, feature_upload_video, feature_upload_audio, feature_quick_search, feature_detailed_search, feature_save_search, feature_add_favorites, feature_send_messages, feature_receive_messages, feature_chat, feature_more_photo, paypal, length) values ('" & name & "', " & price & ", '" & desc & "', '" & feature_post_profile & "', '" & feature_view_profile & "', '" & feature_upload_photo & "', '" & feature_upload_video & "', '" & feature_upload_audio & "', '" & feature_quick_search & "', '" & feature_detailed_search & "', '" & feature_save_search & "', '" & feature_add_favorites & "', '" & feature_send_messages & "', '" & feature_receive_messages & "', '" & feature_chat & "', '" & feature_more_photo & "', '" & paypal & "', '" & length & "')"
    response.write sql
    response.end
    conn.execute(sql)
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #5
    Regular Coder
    Join Date
    Aug 2002
    Location
    Texas
    Posts
    287
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yes, exactly. you probably have a variable you are using in the sql that is not set, quoted when it should not be, or vice-versa.

    fv

  • #6
    New Coder
    Join Date
    Dec 2004
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I get a permission denied on a this line in another page.

    Line 16 aparnetly it is trying to create text file to log the updates.



    vFileName = Server.MapPath("../include")
    vFileName = vFileName & "/constants.asp"
    'response.write vfilename
    'response.end

    'CREATE THE FILE
    Set objFile = objFSO.CreateTextFile(vFileName)

    'BUILD A STRING FOR EACH OF THE NAME/VALUE PAIRS SUBMITED ABOVE

    'THIS IS THE FIRST LINE OF OUR FSO FILE. IT MARKS THE FILE AS ASP
    'objFile.Writeline "<!--#INCLUDE FILE='DIM_CONST.ASP'-->"
    objFile.Writeline vbCRLF&Chr(60)&Chr(37)&vbCRLF


  •  

    Posting Permissions

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