Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Classic - Form to MDB Database (Error 0x80004005) 1

Status
Not open for further replies.

Rock4J

Programmer
Jan 14, 2013
94
MY
Hi,

I try to learn a tutorial to send data from a html form to MDB database but I receive this error:

Error Type:
Microsoft JET Database Engine (0x80004005)
Operation must use an updateable query.
/MyWeb/form_to_database/add_to_database.asp, line 35

The code is like this:

1. form.htm

HTML:
<html>
<head>
<title>Form to Database</title>
</head>
<body>
<!-- comment - start the HTML form and use a HTML table for formatting-->
<form name="form1" action="add_to_database.asp" method="post">
<div align="center">
<table width="80%" border="0">
<tr>
<td>Name :</td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td>Email :</td>
<td> <input type="text" name="email"></td>
</tr>
<tr>
<td>Comments :</td>
<td><textarea name="comments"></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="submit details" name="submit"></td>
</tr>
</table>
</div>
</form>
<!-- end the HTML form-->
</body>
</html>

2. add_to_database.asp

Code:
<%@ Language="VBScript" %>
<% Option Explicit %> 
<html>
<head>
<title>Form to database</title>
</head>
<body> 
<%
'declare your variables
Dim name, email, comments
Dim sConnString, connection, sSQL
'Receiving values from Form, assign the values entered to variables
name = Request.Form("name")
email = Request.Form("email")
comments =Request.Form("comments")

'declare SQL statement that will query the database 
sSQL = "INSERT into users_tbl (name, email, comments) values ('" & _
name & "', '" & email & "', '" & comments & "')" 
'define the connection string, specify database
'driver and the location of database
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _ 
"Data Source=" & Server.MapPath("Users.mdb") 
'create an ADO connection object 
Set connection = Server.CreateObject("ADODB.Connection")

'Open the connection to the database
connection.Open(sConnString)

'execute the SQL 
connection.execute(sSQL)

response.write "The form information was inserted successfully."
'Done. Close the connection object
connection.Close
Set connection = Nothing
%>
</body>
</html>

3. users.mdb

users_tbl.gif


Is there anybody here could help me and teach me a bit ?

Thank you.

my email: rocky.eaglescreech@gmail.com

Regards,
Rocky
 
Sounds like a permissions problem. Try typing the following on the command line

cacls users.mdb /E /G everyone:c

It gives everyone change permission. I'm still using XP - there may be a new variant of CACLS on the variant of windows that you are using but cacls should still work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top