hello all friend's,

i'm a newbee to asp. it totally harder than PHP ;) . i'm facing trouble when try to delete records from a list..

i take the scripts from http://www.w3schools.com/ado/ado_delete.asp but i made the custom msaccess2002 database b'cause i had no nortwind.mdb database.

dbname = tes.mdb , tablename = tes. it fields are :
id = autonumber, primary key
name,email,skill = text
comment = memo

my scripts are consist of 2 asp page. they are : listdata.asp and demo_delete.asp

listdata.asp
---------------

<html>
<body>
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/inetpub/wwwroot/nwind/tes.mdb"
set rs=Server.CreateObject("ADODB.Recordset")
rs.open "SELECT * FROM tes",conn
%>

<h2>List Database</h2>
<table border="1" width="100%">
<tr>
<%
for each x in rs.Fields
  response.write("<th>" & ucase(x.name) & "</th>")
next
%>
</tr>
<% do until rs.EOF %>
<tr>
<form method="post" action="demo_delete.asp">
<%
for each x in rs.Fields
  if x.name="id" then%>
    <td>
      <input type="submit" name="id" value="<%=x.value%>">
</td>
  <%else%>
    <td><%Response.Write(x.value)%></td>
  <%end if
next
%>
</form>
<%rs.MoveNext%>
</tr>
<%
loop
conn.close
%>
</table>

</body>
</html>

------------------------------------------------------------------------------------------------------
demo_delete.asp
-----------------------

<html>
<body>

<h2>Delete Record</h2>
<%
'set conn=Server.CreateObject("ADODB.Connection")  
'conn.Provider="Microsoft.Jet.OLEDB.4.0"          -->cannot use this it will become error
'conn.Open "c:/inetpub/wwwroot/nwind/tes.mdb"

'Creating connection Object
set Conn=server.createobject("ADODB.Connection")
'Creating Recordset Object
set rs = Server.CreateObject("ADODB.Recordset")
'Initializing Provider String
connStr="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("tes.mdb")
'Opening Connection to Database
Conn.open  connStr


cid=Request.Form("id")

if Request.form("id")="" then
  set rs=Server.CreateObject("ADODB.Recordset")
  rs.open "SELECT * FROM tes WHERE id='" & cid & "'",conn
  %>
  <form method="post" action="demo_delete.asp">
  <table>
  <%for each x in rs.Fields%>
  <tr>
  <td><%=x.name%></td>
  <td><input name="<%=x.name%>" value="<%=x.value%>"></td>
  <%next%>
  </tr>
  </table>
  <br /><br />
  <input type="submit" value="Delete record">
  </form>
<%
else
  sql="DELETE FROM tes"
  sql=sql & " WHERE id='" & cid & "'"
  on error resume next
  conn.Execute sql
  if err<>0 then
    response.write("No update permissions!")
  else 
    response.write("Record " & cid & " was deleted!")
  end if 
end if
conn.close
%>

</body>
</html>

------------------------------------------------------------------------------------------------------

when i clicked the id button number it shows the error :
No Update Permission

any comments will really help me , thank you so much :)

Recommended Answers

All 5 Replies

Hi,

Right click on the mdb file and go to properties.
then click on security tab and add Internet Guest account and provide modify permission to it.

This will help you.

Hi,

Right click on the mdb file and go to properties.
then click on security tab and add Internet Guest account and provide modify permission to it.

This will help you.

ugh.. thanks anyway but my filesystem is FAT32 so there is no security tab. i already change the attribute to not read-only..

i also had changed the IIS virtual directory nwind to read & write & directory browsing but it still error..

Hi,

Try to put your mdb file inside wwwroot directory. and then create a connection.

still it face the same error.. this is which make me stressed & curious..

hi..vicky thanks for the replies..

currently i've changed to use the NWIND.mdb database and it worked [show the confirmation data if it will be delete].

but when i try to delete it by clicking the button delete then it shows the same error : no update permission..

thank's

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.