hello
I am newbie and in the process of learning ASP and database.
I want to learn how to add/delete/update/..etc records in databases using ASP.
from the following site:
http://www.w3schools.com/ado/default.asp
I copied a code to add record to a database.
On my pc:
Using MS Access 2003, I have created a database called 'basics.mdb' and the table name is 'basics_table'. I modified the code according to my database path and table.
There is the ASP code:
<html>
<body>
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/database/basics.mdb"
sql="INSERT INTO basics_table (CustomerID,CompanyName,"
sql=sql & "ContactName,Address,City,PostalCode,Country)"
sql=sql & " VALUES "
sql=sql & "('" & Request.Form("custid") & "',"
sql=sql & "'" & Request.Form("compname") & "',"
sql=sql & "'" & Request.Form("contname") & "',"
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>
and there is the html code:
<html>
<body><form method="post" action="disbas_add.asp">
<table>
<tr>
<td>CustomerID:</td>
<td><input name="custid"></td>
</tr><tr>
<td>Company Name:</td>
<td><input name="compname"></td>
</tr><tr>
<td>Contact Name:</td>
<td><input name="contname"></td>
</tr><tr>
<td>Address:</td>
<td><input name="address"></td>
</tr><tr>
<td>City:</td>
<td><input name="city"></td>
</tr><tr>
<td>Postal Code:</td>
<td><input name="postcode"></td>
</tr><tr>
<td>Country:</td>
<td><input name="country"></td>
</tr>
</table>
<br /><br />
<input type="submit" value="Add New">
<input type="reset" value="Cancel">
</form></body>
</html>
the problem is that whenever I try to add a record it doesn't work and I get the following msg: 'No update permissions !'
Can anybody help me please to solve this problem and understand it ?