Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 14th, 2003, 12:27 PM
Authorized User
Points: 139, Level: 2
Points: 139, Level: 2 Points: 139, Level: 2 Points: 139, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Spokane, WA, USA.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can't update Access database under ASP with ADO

Here is the code I used. Two points are commented. The first is where I determined it was updateable. The second is where the error occurred. The current user is a member of the Administrators Group so permissions should be okay. However, maybe the SYSTEM takes over when the Jet Engine is used and a different permission is required. The database is in the same folder as the ASP page and it's attribute is NOT marked as read-only and neither is the folder it is in. Perhaps there are permissions in the IIS area for the application?

<!--metadata type="typelib"
    file="f:\program files\common files\system\ado\msado15.dll"-->

<%
Dim cnConnect,strDataSource,strProvider

strDataSource = "f:\program files\folder\subfolder\AccessDB.mdb"
strProvider = "Microsoft.Jet.OLEDB.4.0"
set cnConnect = Server.CreateObject("ADODB.Connection")

With cnConnect
   .Provider = strProvider
   .ConnectionString = "Data Source = " & strDataSource
   .Open
End With

Dim rsRecordsetUpd
set rsRecordsetUpd = CreateObject("ADODB.Recordset")

With rsRecordsetUpd
   .filter = "RecId='1'"
   .CursorLocation = adUseServer
End With
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -rsRecordsetUpd.open "tblTable", cnConnect, adOpenKeyset, adLockOptimistic, adCmdTable
** If rsRecordsetUpd.supports (adUpdate) ---> returns TRUE.
** Therefore the update should be possible.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -rsRecordsetUpd("field") = Request.Form("data")
rsRecordsetUpd.update
** But when attempted the error is (abbrv.):
** "MS Jet DB cannot update. Database or object is read-only."
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
rsRecordsetUpd.close
set rsRecordsetUpd = nothing
%>

  #2 (permalink)  
Old September 14th, 2003, 01:47 PM
Authorized User
Points: 139, Level: 2
Points: 139, Level: 2 Points: 139, Level: 2 Points: 139, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Spokane, WA, USA.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In life when you ask someone something it seems to reactivate your own thinking and often you answer your own question. In this case I was assuming that since I was in the Administrators Group the OS would see that I was there and authenticate me just like when it sees you are in the Users Group and it grants you access. However, I added myself specifically anyway to the database permissions and checked the Write attribute to handle the updating. Upon retesting everything worked like it should. Apparently my above assumption doesn't apply in the way I was thinking about it. There's no reason to help solve my problem anymore so thanks anyway.
  #3 (permalink)  
Old September 15th, 2003, 09:40 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

bnorg,

Keep in mind that when you access that file from ASPX you are not authenticating as your username, you are authenticating as the username given to the iis process. This is usually either ASPNET or IUSR_<machinename>. It is possible that when you browse the page with I.E. your username gets passed to the server and this is why changing the permissions for your username worked for you. If you try browsing that page that accesses the database from another user's machine you might be able to get it break again.

Permissions are a pain.

Peter
  #4 (permalink)  
Old September 15th, 2003, 10:05 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I usually give permission to Users. Is that bad?
  #5 (permalink)  
Old September 15th, 2003, 10:13 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

It's ok only if the only users using your asp application are users on your network for which you have user accounts which you can use for permissions on that file. But even then, I wouldn't recommend doing that.

You should provide access to that DB file to the IIS process "user" and you then don't need to mess with the permissions any more with specific users. Usually, as long as you have the directory the DB file lives in set up correctly, you can put other DB files in there and not have to change their individual settings. As long as they are writable you should not have a problem accessing them.

Peter
  #6 (permalink)  
Old September 15th, 2003, 08:21 PM
Friend of Wrox
 
Join Date: Aug 2003
Location: , , .
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to life_s Ng Send a message via MSN to life_s Ng
Default

hi Peter. how to "provide access to that DB file to the IIS process "user" "? may i know this...? Pardon my ignorance...

best regards
life's Ng

  #7 (permalink)  
Old September 16th, 2003, 02:18 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Go into Internet Information Services.
Navigate to the website and/or virtual directory that you wish to modify.
Right-click and choose Properties.
On the "Directory Security" tab you can edit the access rights.
Click Edit to make changes.
Click the Edit button in the Anonymous frame and you can see what user account will be used for anonymous access.

Usually what I do is set it up to only allow Anonymous access. I uncheck all of the other options. Once you have done this, the "user" who's accessing the directory and files should only be the IIS user (either IUSR_<computername> or ASPNET).

In order for that user to update an Access MDB file, you'll need to provide that user (IUSR_<computername>) with write permission in windows so the IIS process can save the file. Do this thru windows explorer.

HTH,
Peter
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
!!HELP! trying to update an Access database brawny4 VB Databases Basics 4 April 24th, 2007 02:07 PM
ADO Connection between 2 MS Access Database Scripts82 Access VBA 2 February 8th, 2006 02:35 AM
Backup an open access database (ado) jolzy VB Databases Basics 0 October 27th, 2004 09:38 AM
Access database won't update? jula Access ASP 8 September 26th, 2004 05:46 PM
Database update access inershado Access ASP 1 September 23rd, 2003 11:26 PM



All times are GMT -4. The time now is 06:12 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.