feedback database

S

Sanju

hai to every one....
here is my question
I have designed a form using ASP ,to collect the feedback report from the
user,which includes Name, staffno and the comments and to store the results
in an Access Database.But when I submit the form, getting the following error
message as


Error Type:
Microsoft JET Database Engine (0x80004005)
Operation must use an updateable query.
/feedbackform/formreport.asp, line 36




<html>
<% @LANGUAGE="VBScript" %>
<body>
<%
' Declaring variables
Dim username, userstaffno, usercomments, data_source,
con, sql_insert

' A Function to check if some field entered by user is
empty
Function ChkString(string)
If string = "" Then string = " "
ChkString = Replace(string, "'", "''")
End Function

' Receiving values from Form
username = ChkString(Request.Form("usernme"))
userstaffno = ChkString(Request.Form("userstffno"))
usercomments = ChkString(Request.Form("usercommnts"))


data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=" &_
Server.MapPath("formreport.mdb")

sql_insert = _
"insert into formreport (username,userstaffno,usercomments)"
sql_insert = sql_insert & " values ('" & _
Replace(Request.Form("username"),"'","''") & "','" & _
Replace(Request.Form("userstaffno"),"'","''") & "','" & _
Replace(Request.Form("usercomments"),"'","''") & "')"




' Creating Connection Object and opening the database
Set con = Server.CreateObject("ADODB.Connection")
con.Open data_source
con.Execute sql_insert

' Done. Close the connection
con.Close
Set con = Nothing
Set sql_insert = Nothing
Response.Write "All records were successfully entered
into the database."
%>
</body>
</html>


Any help is greatly appreciated
 
K

Klatuu

Some queries, because of the nature of the joins, Union Queries, and Total
quereis produce recordsets that cannot be updated. That is, you can't add
records, delete records, or edit records.

The easiest way to test your query is to open the query in datasheet view.
If the add record navigation button (with the *) is greyed out, it means the
recordset is uneditable. You will need to restructure your query so it will
allow edits.
 
T

Tom van Stiphout

On Mon, 12 May 2008 03:35:00 -0700, Sanju

What is formreport? I'm guessing it is a non-updatable query. Test
this in the Access UI: can you open the query and add a row?
Perhaps better switch to a simpler query on a single table.

Why are you asking for Name and Staffno? Smells like bad database
design. Couldn't you look up the EmployeeName when given the
EmployeeNo?

-Tom.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top