0

Hello guys,

I am new in ASP, ADO and IIS, but I find a good tutorial in w3schools. I've started reading the ADO tutorial, because I want to create a simple web page, which is connected to a database.
I will use Access database (.mdb).

So, I've created two web pages. First one is for importing the data in fields, this data should be imported in the Access database. Second one is for importing the data from the fields to the database.

Here the code for the first page:

<html>
<body>

<form method="post" action="input.asp">
<table>
<tr>
<td>Номер на протокола:</td>
<td><input name="protocolid"></td>
</tr><tr>
<td>Номер на клиента:</td>
<td><input name="clientid"></td>
</tr><tr>
<td>Име на клиента:</td>
<td><input name="clientname"></td>
</tr><tr>
<td>Дата на посещение:</td>
<td><input name="date"></td>
</tr><tr>
<td>Проблем:</td>
<td><input name="problem"></td>
</tr><tr>
<td>Решение:</td>
<td><input name="solution"></td>
</tr><tr>
<td>Коментар:</td>
<td><input name="comment"></td>
</tr><tr>
<td>Служител отишъл на мястото:</td>
<td><input name="employee"></td>
</tr><tr>
<td>Слежител на фирмата приел протокола:</td>
<td><input name="contactperson"></td>
</tr>
</table>
<br /><br />
<input type="submit" value="Добави протокола">
<input type="reset" value="Изчисти">
</form>

</body>
</html>

Here is the code for the second page:

<html>
<body>

<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "D:\Inetpub\wwwroot\Protocols.mdb"

sql="INSERT INTO Protocols(ClientID,ClientName,"
sql=sql & "Date,Problem,Solution,Comment,Employee,ContactPerson)"
sql=sql & " VALUES "
sql=sql & "('" & Request.Form("clientID") & "',"
sql=sql & "'" & Request.Form("clientName") & "',"
sql=sql & "'" & Request.Form("date") & "',"
sql=sql & "'" & Request.Form("problem") & "',"
sql=sql & "'" & Request.Form("solution") & "',"
sql=sql & "'" & Request.Form("comment") & "',"
sql=sql & "'" & Request.Form("employee") & "',"
sql=sql & "'" & Request.Form("contactperson") & "')"

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>

So, my problem is that I get this error: "No update permissions!"

I've saw that this error happen really often, but there is not any solutions of it.
I've tried a lot of thing to solve the problem, like set permissions to database for IUSR_machine and EVERYONE; copy the database in the other place and so on.

Can you please help me with this problem?

Thank you!

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by vsmash
0

You have to set the lock type and Cursor Location try this code :

Set conn= Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.RecordSet")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "D:\Inetpub\wwwroot\Protocols.mdb"

Rs.LockType = 2
Rs.CursorLocation = 2
rs.open "select * from Protocols",conn
Rs.AddNew
Rs.Fields("ClientID") =  Request.Form("clientID")
Rs.Fields("ClientName") =  Request.Form("ClientName")
Rs.Update
Rs.Close
conn.close
0

Your example too simple mate - no offense intended.
1. you have to make the data agreeable with the sql code. eg:

sql=sql & "'" & Replace(Request.Form("problem")&"","'","''") & "',"

2. you have to make sure that the fields are allowed to be eimpty in the database.
3. if you are inserting a number, it doesn't need quotation marks
4. Your error message isn't telling you the problem:
replace:

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

with

on error resume next
conn.Execute sql,recaffected
if err<>0 then
Response.Write("ERROR: " & err.description)
else
Response.Write("<h3>" & recaffected & " record added</h3>")
end if
conn.close
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.