By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,061 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

Insert data into access database

P: 347
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
Expand|Select|Wrap|Line Numbers
  1. <form action="adddiary.asp" method="post">
  2. <table width="100%" cellpadding="0" cellspacing="0">
  3.   <tr>
  4.     <td width="6%" align="center"><input name="newinvoicenumber" type="text" size="10" maxlength="10"></td>
  5.     <td width="12%" align="center"><input name="newartistname" type="text" size="30" maxlength="50"></td>
  6.     <td width="10%" align="center"><input name="newtime" type="text" size="25" maxlength="25"></td>
  7.     <td width="11%" align="center"><input name="newstudio" type="text" size="25" maxlength="50"></td>
  8.     <td width="15%" align="center"><input name="newagency" type="text" size="40" maxlength="100"></td>
  9.     <td width="16%" align="center"><input name="newproduct" type="text" size="40" maxlength="100"></td>
  10.     <td width="14%" align="center"><input name="newproducer" type="text" size="40" maxlength="80"></td>
  11.     <td width="5%" align="center"><input name="newfee" type="text" size="6" maxlength="10"></td>
  12.     <td width="11%" align="center"><label for="select">Select State</label>
  13.       <select name="newstate" id="select" >
  14.         <option value="Pencil">pencil</option>
  15.         <option value="confirmed">confirmed</option>
  16.         <option value="message">message</option>
  17.         <option value="messageconfirmed">message confirmed</option>
  18.         <option value="email">email</option>
  19.         <option value="emailconfirmed">email confirmed</option>
  20.         <option value="txtconfirmed">text</option>
  21.       </select>
  22.       </td>
  23.   </tr>
  24.   <tr>
  25.   <td>
  26.   <input type="hidden" value="<% Response.Write(datetouse) %>" name="newdate">
  27.   <input type="submit">
  28.   </td>
  29.   </tr>
  30. </table>
  31. </form>
insert page sql

Expand|Select|Wrap|Line Numbers
  1. <%
  2. On Error Resume Next
  4. Response.Expires=0
  5. Set diaryConnection=Server.CreateObject("ADODB.Connection")
  6. DatabaseDetails="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("../../private/diary.mdb") & ";"
  7. diaryConnection.Open DatabaseDetails
  8. 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")&"')"
  9. Response.Write (diaryQuery)
  10. diaryConnection.execute(diaryQuery)
  11. %>
any ideas would be appreciated
May 9 '12 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 164
Get rid of the "On Error Resume Next" and rerun the script. If you have an error, it should display.
May 20 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.