Insert data into access database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • colinod
    Contributor
    • Nov 2007
    • 347

    Insert data into access database

    I have the follwoing code that is trying to insert data into my yabel, the pages do not throw up any errors but i get nothing added to the database, has anyone got any ideas

    Form Page
    Code:
    <form action="adddiary.asp" method="post">
    <table width="100%" cellpadding="0" cellspacing="0">
      <tr>
        <td width="6%" align="center"><input name="newinvoicenumber" type="text" size="10" maxlength="10"></td>
        <td width="12%" align="center"><input name="newartistname" type="text" size="30" maxlength="50"></td>
        <td width="10%" align="center"><input name="newtime" type="text" size="25" maxlength="25"></td>
        <td width="11%" align="center"><input name="newstudio" type="text" size="25" maxlength="50"></td>
        <td width="15%" align="center"><input name="newagency" type="text" size="40" maxlength="100"></td>
        <td width="16%" align="center"><input name="newproduct" type="text" size="40" maxlength="100"></td>
        <td width="14%" align="center"><input name="newproducer" type="text" size="40" maxlength="80"></td>
        <td width="5%" align="center"><input name="newfee" type="text" size="6" maxlength="10"></td>
        <td width="11%" align="center"><label for="select">Select State</label>
          <select name="newstate" id="select" >
            <option value="Pencil">pencil</option>
            <option value="confirmed">confirmed</option>
            <option value="message">message</option>
            <option value="messageconfirmed">message confirmed</option>
            <option value="email">email</option>
            <option value="emailconfirmed">email confirmed</option>
            <option value="txtconfirmed">text</option>
          </select>
          </td>
      </tr>
      <tr>
      <td>
      <input type="hidden" value="<% Response.Write(datetouse) %>" name="newdate">
      <input type="submit">
      </td>
      </tr>
    </table>
    </form>
    insert page sql

    Code:
    <%
    On Error Resume Next
    
    Response.Expires=0
    Set diaryConnection=Server.CreateObject("ADODB.Connection")
    DatabaseDetails="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("../../private/diary.mdb") & ";"
    diaryConnection.Open DatabaseDetails
    diaryQuery="INSERT INTO diary (invoicenumber, bookingdate, artistname, time, studio, agency, product, producer, fee, state) VALUES ('"&Request.Form("newinvoicenumber")&"', '"&Request.Form("newdate")&"', '"&Request.Form("newartistname")&"', '"&Request.Form("newtime")&"', '"&Request.Form("newstudio")&"', '"&Request.Form("newagency")&"', '"&Request.Form("newproduct")&"', '"&Request.Form("newproducer")&"', '"&Request.Form("newfee")&"', '"&Request.Form("newstate")&"')"
    Response.Write (diaryQuery)
    diaryConnection.execute(diaryQuery)
    %>
    any ideas would be appreciated
  • Nicodemas
    Recognized Expert New Member
    • Nov 2007
    • 164

    #2
    Get rid of the "On Error Resume Next" and rerun the script. If you have an error, it should display.

    Comment

    Working...