inserting a record into access database 2007 using asp

Author Message
vaas

  • Total Posts : 1
  • Scores: 0
  • Reward points : 0
  • Joined: 6/20/2010
  • Status: offline
inserting a record into access database 2007 using asp Sunday, June 20, 2010 6:40 PM (permalink)
0
<html>
<body>

<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/inetpub/wwwroot/mydata1.accdb"

sql="INSERT INTO customers (customerID,companyname,"
sql=sql & "contactname,address,city,postalcode,country)"
sql=sql & " VALUES "
sql=sql & "('" & Request.Form("empid") & "',"
sql=sql & "'" & Request.Form("empname") & "',"
sql=sql & "'" & Request.Form("contno") & "',"
sql=sql & "'" & Request.Form("address") & "',"
sql=sql & "'" & Request.Form("city") & "',"
sql=sql & "'" & Request.Form("postcode") & "',"
sql=sql & "'" & Request.Form("country") & "')"

on error resume next
conn.Execute sql,recaffected
if err<>0 then
  Response.Write("No update permissions!")
else
  Response.Write("<h3>" & recaffected & " record added</h3>")
end if
conn.close
%>

</body>
</html>


when i am executing this asp page the error message is being displayed.i am using access 2007.i am able to select the records but not able to insert.sometimes i get http 500 error.pls help
 
#1
    centauricw

    • Total Posts : 42
    • Scores: 2
    • Reward points : 0
    • Joined: 2/20/2006
    • Status: offline
    Re:inserting a record into access database 2007 using asp Thursday, July 01, 2010 5:30 PM (permalink)
    0
    The Internet Guest account that the ASP script under (which in set in IIS) must have write access to the Access database file.  Normally, the Internet Guest account only has read access to the web site folder and this would cause the exact error you are getting.
     
    #2

      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 1 guests.

      Icon Legend and Permission

      • New Messages
      • No New Messages
      • Hot Topic w/ New Messages
      • Hot Topic w/o New Messages
      • Locked w/ New Messages
      • Locked w/o New Messages
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2012 ASPPlayground.NET Forum Version 3.9