Link to home
Start Free TrialLog in
Avatar of Eric Bourland
Eric BourlandFlag for United States of America

asked on

ASP (classic) application throws error -- permissions problem?

Hi. I am having trouble with an ASP (Classic) application.

The application is called directory_edit.asp. I append its full code. It is a simple application used to edit a directory of people in a database table.

When I try to edit a record, I get this error:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.

/maint/directory_edit.asp, line 55


So, it looks like a permissions problem? This application was ported over from another server, where it was working fine. I suspect the classic ASP code is OK, but there is a permissions problem?

I am grateful as always for any advice.

peace,

Eric
<!-- #include file = "header_maint_inc.asp" -->
<div id="content">
 
		<h2>Edit/Create a Directory Entry</h2>
<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open session("conn_CarePlanners_db")
if request("id") <> "" and isNumeric(request("id")) then
	record_id = request("id")
else
	record_id = "0"
end if
if request("sign_up") = "YES" then
	sign_up = true
else
	sign_up = false
end if
 
 
if request("action") = "Update" then
	sql = "update directory set "
	sql = sql & "prefix = " & quotestring(request("prefix"),",")
	sql = sql & "firstname = " & quotestring(request("firstname"),",")
	sql = sql & "middleinit = " & quotestring(request("middleinit"),",")
	sql = sql & "lastname = " & quotestring(request("lastname"),",")
	sql = sql & "suffix = " & quotestring(request("suffix"),",")
	sql = sql & "company = " & quotestring(request("company"),",")
	sql = sql & "region = " & quotestring(request("region"),",")
	sql = sql & "primaryphone = " & quotestring(request("primaryphone"),",")
	sql = sql & "email = " & quotestring(request("email"),",")
	sql = sql & "website = " & quotestring(request("website"),",")
	sql = sql & "street1 = " & quotestring(request("street1"),",")
	sql = sql & "city1 = " & quotestring(request("city1"),",")
	sql = sql & "state1 = " & quotestring(request("state1"),",")
	sql = sql & "zip1 = " & quotestring(request("zip1"),",")
	sql = sql & "country1 = " & quotestring(request("country1"),",")
	sql = sql & "phone1 = " & quotestring(request("phone1"),",")
	sql = sql & "fax1 = " & quotestring(request("fax1"),",")
	sql = sql & "street2 = " & quotestring(request("street2"),",")
	sql = sql & "city2 = " & quotestring(request("city2"),",")
	sql = sql & "state2 = " & quotestring(request("state2"),",")
	sql = sql & "zip2 = " & quotestring(request("zip2"),",")
	sql = sql & "country2 = " & quotestring(request("country2"),",")
	sql = sql & "phone2 = " & quotestring(request("phone2"),",")
	sql = sql & "fax2 = " & quotestring(request("fax2"),",")
	sql = sql & "chbdegrees = " & quotestring(request("chbdegrees"),",")
	sql = sql & "chbcertifications = " & quotestring(request("chbcertifications"),",")
	sql = sql & "practice = " & quotestring(request("practice"),",")
	sql = sql & "chbpediatric = " & quotestring(request("chbpediatric"),",")
	sql = sql & "chbadult = " & quotestring(request("chbadult"),",")
	sql = sql & "info = " & quotestring(request("info"),",")
	sql = sql & "sign_up = " & sign_up & ","
	sql = sql & "verified = " & request("verified")
	sql = sql & " where id = " & record_id
	conn.execute(sql)
	conn.close
	set conn = nothing
	%>
	<script>
	alert("Direcory record was updated.")
	document.location = "index.asp"
	</script>
	<%
end if
if request("action") = "Delete" then
	sql = "delete * from  directory where id = " & record_id
	conn.execute(sql)
	conn.close
	set conn = nothing
	%>
	<script>
	alert("Direcory record was deleted.")
	document.location = "index.asp"
	</script>
	<%
end if
if request("action") = "Submit" then
    %><!-- #include file = "registration_save_inc.asp" --><%
	if (firstname = "" or lastname = "" or company = "" or primaryphone = "" or email = "" or street1 = "" or city1 = "" or state1 = "" or zip1 = "" or country1 = "" or phone1 = "" or chbdegrees = "" or chbcertifications = "" or practice = "" or chbpediatric = "" or chbadult ="") and request("action") = "Submit" then
		%><script>alert('You did not fill a required field. All fields marked * are required.')</script><%
	end if
end if
 
 
sql = "select * from directory where id = " & record_id
set RS = conn.execute(sql)
if not RS.eof then
	prefix            = RS("prefix")
	firstname         = RS("firstname")
	middleinit        = RS("middleinit")
	lastname          = RS("lastname")
	suffix            = RS("suffix")
	company           = RS("company")
	region            = RS("region")
	primaryphone      = RS("primaryphone")
	email             = RS("email")
	website           = RS("website")
	street1           = RS("street1")
	city1             = RS("city1")
	state1            = RS("state1")
	zip1              = RS("zip1")
	country1          = RS("country1")
	phone1            = RS("phone1")
	fax1              = RS("fax1")
	street2           = RS("street2")
	city2             = RS("city2")
	state2            = RS("state2")
	zip2              = RS("zip2")
	country2          = RS("country2")
	phone2            = RS("phone2")
	fax2              = RS("fax2")
	chbdegrees        = RS("chbdegrees")
	chbcertifications = RS("chbcertifications")
	practice          = RS("practice")
	chbpediatric      = RS("chbpediatric")
	chbadult          = RS("chbadult")
	info              = RS("info")
	verified          = RS("verified")
	sign_up		   = RS("sign_up")
end if
Rs.close
set RS = nothing
conn.close
set conn = nothing
 
function quotestring(s, endchar)
	s = replace(trim(s),"'","''")
   	quotestring = "'" & s & "'" & endchar
end function
 
maint = true
%>
<form name="regform" method="post" action="directory_edit.asp?id=<%=record_id%>">
	<!-- #include virtual = "/directory_form_inc.asp" -->
</form>
	
 
</div>
<!-- #include file = "footer_maint_inc.asp" -->

Open in new window

SOLUTION
Avatar of Devario Johnson
Devario Johnson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
second thought try a 0755

777 is the most "writeable" but if you can get to 0755 to work that would be better
Avatar of Eric Bourland

ASKER

Hi. Thanks for this. I should have said: It is a Windows 2003 server. Using ASP classic.

Is there a user to whom or application to which I need to grant rights to write or execute a program?
>>Is there a user to whom or application to which I need to grant rights to write or execute a program?
IUSR_ is the name of you server.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
hielo -- very helpful. I will try this and get back to you. Eric
hielo -- it worked. Thank you. I also had to give folder permission to the authenticated user who has access to that folder.

devarioj -- thank you very much for your help, as well.

Have a great evening.

Eric
you are welcome.
You are welcome