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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2017
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can't insert data in accessDB using HTML form.

    Hi,
    i call to action this "insertdata.asp" file and entries are not inserted in my accessDB file.
    Could you please help me on that?

    <%
    Dim adoCon
    Dim rsAddComments
    Dim strSQL

    Set adoCon = Server.CreateObject("ADODB.Connection")


    adoCon.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=J:\John\__Ecommerce_____\ASP\DB_Form\app_data\clients.accdb"

    Set rsAddComments = Server.CreateObject("ADODB.Recordset")

    strSQL = "SELECT clientname, phone, email, lastservicedate, more-info FROM clients;"

    rsAddComments.CursorType = 2
    rsAddComments.LockType = 3
    rsAddComments.Open strSQL, adoCon

    rsAddComments.AddNew

    rsAddComments.Fields("clientname") = Request.Form("clientname")
    rsAddComments.Fields("phone") = Request.Form("phone")
    rsAddComments.Fields("email") = Request.Form("email")
    rsAddComments.Fields("lastservicedate") = Request.Form("lastservicedate")
    rsAddComments.Fields("more-info") = Request.Form("more-info")

    rsAddComments.Update

    rsAddComments.Close
    Set rsAddComments = Nothing
    Set adoCon = Nothing


    Response.Redirect "index.asp"


    %>

  2. #2
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,114
    Thanks
    5
    Thanked 11 Times in 11 Posts
    this is not asp.net code. it is classic asp, using vbscript

    However, is the above code exactly what your page has? If so the first thing that jumps out is the missing closing quote and parenthesis ") in each field

    PHP Code:
    rsAddComments.Fields("clientname") = Request.Form("clientname")
    rsAddComments.Fields("phone") = Request.Form("phone")
    rsAddComments.Fields("email") = Request.Form("email")
    rsAddComments.Fields("lastservicedate") = Request.Form("lastservicedate")
    rsAddComments.Fields("more-info") = Request.Form("more-info"
    Last edited by miranda; 03-22-2017 at 09:46 PM.


 

Tags for this Thread

Posting Permissions

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