feedback database

S

Sanju

Hai......
I have designed a project using ASP which collects the feedback from the
user,the form feilds include name , staffno and comments and storing the same
in access database.But when I run the program I am 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
 
M

Maurice

Just a 'wild guess' but try changing

con.Execute sql_insert

to

con.ExecuteNonQuery sql_insert
 

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