Jump to content

ADO Connection Permission Problems


johnor

Recommended Posts

Hi,I have a problem in getting the permissions working with an Ms Access .mdb database using Ado connection with asp pages. I have changed the permissions in the Access database, changed permissions on all the directories, changed the security permissions for IIs and I still get the same error. Here is the code:Data Entry file ado10.asp:<html><body><form method="post" action="demo_add.asp"><table><tr><td>CustomerID:</td><td><input name="custid"></td></tr><tr><td>Company Name:</td><td><input name="compname"></td></tr><tr><td>Contact Name:</td><td><input name="contname"></td></tr><tr><td>Address:</td><td><input name="address"></td></tr><tr><td>City:</td><td><input name="city"></td></tr><tr><td>Postal Code:</td><td><input name="postcode"></td></tr><tr><td>Country:</td><td><input name="country"></td></tr></table><br /><br /><input type="submit" value="Add New"> <input type="reset" value="Cancel"></form></body></html>demo_add.asp File:<html><body><%set conn=Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open "F:/Documents and Settings/All Users/Documents/northwind.mdb"sql="INSERT INTO customers (customerID,companyname,"sql=sql & "contactname,address,city,postalcode,country)"sql=sql & " VALUES "sql=sql & "('" & Request.Form("custid") & "',"sql=sql & "'" & Request.Form("compname") & "',"sql=sql & "'" & Request.Form("contname") & "',"sql=sql & "'" & Request.Form("address") & "',"sql=sql & "'" & Request.Form("city") & "',"sql=sql & "'" & Request.Form("postcode") & "',"sql=sql & "'" & Request.Form("country") & "')"on error resume nextconn.Execute sql,recaffectedif err<>0 thenResponse.Write("No update permissions!")else Response.Write("<h3>" & recaffected & " record added</h3>")end ifconn.close%></body></html>I realize this has been answered many times in this forum but I have tried the suggestions and they are not working for me. Appreciate any help you can offer.John O'Rourke

Link to comment
Share on other sites

Hi,Thanks for the quick response.Here is the newly created demo_add2.asp which is run from ado11.asp<html><body><%set conn=Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open "F:/Documents and Settings/All Users/Documents/northwind.mdb"sql="INSERT INTO customers (customerID,companyname,"sql=sql & "contactname,address,city,postalcode,country)"sql=sql & " VALUES "sql=sql & "('" & Request.Form("custid") & "',"sql=sql & "'" & Request.Form("compname") & "',"sql=sql & "'" & Request.Form("contname") & "',"sql=sql & "'" & Request.Form("address") & "',"sql=sql & "'" & Request.Form("city") & "',"sql=sql & "'" & Request.Form("postcode") & "',"sql=sql & "'" & Request.Form("country") & "')"on error resume nextconn.Execute sql,recaffectedResponse.Write("<h3>" & recaffected & " record added</h3>")conn.close%></body></html>The program now simply says record added and does not "error out". When I examine northwind.mdb in the directory referred to, it has not been changed. I also took out the "on error resume next" statement and then I did get an internal server error:Error Type:Microsoft JET Database Engine (0x80004005)Operation must use an updateable query./project3/demo_add2.asp, line 18Browser Type:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/0.3.154.9 Safari/525.19Page:POST 97 bytes to /project3/demo_add2.aspPOST Data:custid=aaccdd&compname=ffa%3Bjaf%3Bj&contname=ireia%3Ba%3Ba%3B&address=w&city=&postcode=&country=Time:Thursday, November 06, 2008, 2:57:07 PMso apparently I don't have an updateable query ? I thought this might be due to me being in the notepad editor for the demo_add2.asp when I executed the query but this was not the case because the same error occurs when I am out of notepad entirely.Appreciate any HelpJohn O'Rourke

Link to comment
Share on other sites

Hi,I appreciate the response once again, but in the second part of my reply I showed that I had removed the "on error resume next" statement also and that then I got an error having to do with the operation having to use an updateable query. I checked the demo_add2.asp and ado11.asp text files and they are updateable, so I'm not sure what the error is telling me.Thanks again,John O'Rourke

Link to comment
Share on other sites

okay, sorry again, trying to do too many things at once :)So we are back to square one. That error pretty much means it is security related.Review this help article from MS and let me know if any of those suggestions help. http://support.microsoft.com/kb/175168It is most likely you don't have the proper users set up.

Link to comment
Share on other sites

Hi, Thanks for the bulletin.It is hard to decipher the Microsoft Bulletin Q175168 since it seems to be talking about capabilities that I don't have. It offers 4 steps, some of which I have tried already.Step 1. Use the Explorer to find IUSR_Machine Internet Guest user account and change it to give it write permissions. Is it talking about the Windows Explorer program? If so there is no Security tab in the Explore. Is it talking about the Internet Explorer? If so the security tab doesn't show me anything about the Internet guest account or the IUSR_Machine. Realize that I am using Windows XP pro service pack 2. I also am using the Chrome browser or sometimes Firefox and rarely Internet Explorer. If I use regedit there is an option in it to show permissions for various users from the Administrator on down. I am logged on as administrator and have Full control. But there is a user line in the permissions who only has read permission. Could that be it? I hesitate to just fiddle with the system registry without knowing the consequences.Step 2. Using the conn.Mode=3 for admodeReadWrite mode. I have done this in the past and now and it still gives the error message.Step 3. Speaks of DSN values and the ODBC manager. I am not aware of that function being in XP pro. Is it talking about SQL server functions? I don't have that. I don't see anything specific inside Access about it. Maybe I don't need it because the code is bypassing it?Step 4. It is suggesting that the relationships may have something to do with the update so that a cascading update may be needed. I copied only the customer table out of northwind.mdb and put it in southwind.mdb. So there is only one table in the new database and it has no relationships established. When i execute the code with the new changes, it gives exactly the same error for updateable query.So... unless it is the regedit solution that I tentatively offered above , I am fresh out of answers. Hope you can help.Thanks.John O'Rourke

Link to comment
Share on other sites

It is referring to Windows Explorer. go to My Computer and then navigate to your database file. Right click on the file and choose Properties. Then click the Security tab.In the list of users if there is not a user called IUSR_YOURCOMPUTERNAME (you can find your computers name by right clicking on My Computer choosing Properties then click the Computer Name tab) you need to create it and make sure it has read and write permissions to the file.It has been a long time since I used ASP or Access but that should work.

Link to comment
Share on other sites

Dear Aspnetguy,I appreciate your perseverance on this issue.There is no security tab off of the properties using Explorer. It just shows that the database/file is read only or not. That, of course, has been deselected. But there is no securities tab in XP. I have noticed this suggestion elsewhere on the site. Maybe they are talking about a feature in NT.Awaiting your assistance.John O'Rourke

Link to comment
Share on other sites

Dear Aspnetguy,I appreciate your perseverance on this issue.There is no security tab off of the properties using Explorer. It just shows that the database/file is read only or not. That, of course, has been deselected. But there is no securities tab in XP. I have noticed this suggestion elsewhere on the site. Maybe they are talking about a feature in NT.Awaiting your assistance.John O'Rourke
You do have a security tab, it is just hidden by default. Look here to unhide it. http://www.mydigitallife.info/2006/07/19/m...p-professional/
Link to comment
Share on other sites

Dear Aspnetguy,Voila! Your last suggestion did the trick!I had a small problem still with writing too much data into the customer number but the record was updated in the database after I corrected that issue.This was a lot of work but it is very satisfying to have solved the problem.I owe you.Thanks.John O'Rourke

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...