.NETGURU
Error Trying to Update an Access Database
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-oledb' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Bob Avallone
-- Moved from [aspngfreeforall] to [ngfx-oledb] by Chaz <Click here to reveal e-mail address> --

I try to update an Access Database using an Update query and the
following code:

Dim comAnyCommand As OleDbCommand
Dim shoRows As Short

Try
comAnyCommand = New OleDbCommand(pstrSQL, mdcnDatabase)
shoRows = comAnyCommand.ExecuteNonQuery()

The execute fails the error is:

Operation must use an updateable query.

I found this problem on the knowledge base. This is what it says:

CAUSE
Because of security concerns, the ASP.NET worker process runs under the
default ASPNET account. If you do not enable impersonation for an
application, all of the threads that run the requests for that
application run under the process account.

This problem occurs because the ASPNET account does not have sufficient
permissions to connect to or write to an Access database.

RESOLUTION
To work around this problem, use one of the following methods:

Configure the ASP.NET worker process to run under the SYSTEM account in
the <processModel> section of the Machine.config file.

For security reasons, Microsoft recommends that you enable impersonation
on your ASP.NET application. This method works if the impersonated user
has necessary permissions to the computer and the database that you are
accessing.

Grant read and write permissions for the "Everyone" group on the
database and the database folder. This method is not safe; therefore,
Microsoft does not recommend this method.

The problem is that it's not clear exactly how to implement these
solutions. What steps do I take?

Bob

Reply to this message...
 
    
Peter Brunone
Bob,

    The solutions below are rather cryptic (as you observed). Offhand, I'd say
just give the ASPNET account Read/Write access to the .mdb file and its
directory. If that doesn't work -- or if you don't want to do that for
whatever reason -- I would recommend option 1 below, i.e.

|Configure the ASP.NET worker process to run under the SYSTEM account in
|the <processModel> section of the Machine.config file.

    You can find the machine.config on your system drive (I'll just assume C)
in the following directory (version number may be different for you):

C:\WINNT\Microsoft.NET\Framework\v1.0.3705\CONFIG\machine.config

    There is a <processModel> tag in this XML file in which the "user"
attribute specifies which account to use for the ASP.NET process. The
default is user="machine", which uses the ASPNET account (somewhat lower
security privileges); you can specify an arbitrary user account or "SYSTEM",
which will let the process run as the operating system (which by default has
access to everything).

    Let us know how this works out and which option you decide to use...

Cheers,

Peter

|-----Original Message-----
|From: Bob Avallone [mailto:Click here to reveal e-mail address]
|Sent: Saturday, March 30, 2002 12:02 PM
|To: ngfx-oledb
|Subject: [ngfx-oledb] Error Trying to Update an Access Database
|
|I try to update an Access Database using an Update query and the
|following code:
|
| Dim comAnyCommand As OleDbCommand
| Dim shoRows As Short
|
|
| Try
| comAnyCommand = New OleDbCommand(pstrSQL, mdcnDatabase)
| shoRows = comAnyCommand.ExecuteNonQuery()
|
|The execute fails the error is:
|
|Operation must use an updateable query.
|
|I found this problem on the knowledge base. This is what it says:
|
|CAUSE
|Because of security concerns, the ASP.NET worker process runs under the
|default ASPNET account. If you do not enable impersonation for an
|application, all of the threads that run the requests for that
|application run under the process account.
|
|This problem occurs because the ASPNET account does not have sufficient
|permissions to connect to or write to an Access database.
|
|RESOLUTION
|To work around this problem, use one of the following methods:
|
|Configure the ASP.NET worker process to run under the SYSTEM account in
|the <processModel> section of the Machine.config file.
|
|For security reasons, Microsoft recommends that you enable impersonation
|on your ASP.NET application. This method works if the impersonated user
|has necessary permissions to the computer and the database that you are
|accessing.
|
|Grant read and write permissions for the "Everyone" group on the
|database and the database folder. This method is not safe; therefore,
|Microsoft does not recommend this method.
|
|The problem is that it's not clear exactly how to implement these
|solutions. What steps do I take?
|
|Bob

Reply to this message...
 
    
Bob Avallone
I try giving the System user access to the MDB and the directory. I try
modified the processModel tag user from "machine" to "system"

<processModel enable="true" timeout="Infinite" idleTimeout="Infinite"
shutdownTimeout="0:00:05" requestLimit="Infinite"
requestQueueLimit="5000" restartQueueLimit="10" memoryLimit="60"
webGarden="false" cpuMask="0xffffffff" userName="system"
password="AutoGenerate" logLevel="Errors" clientConnectedCheck="0:00:05"
comAuthenticationLevel="Connect" comImpersonationLevel="Impersonate"
responseRestartDeadlockInterval="00:09:00"
responseDeadlockInterval="00:03:00" maxWorkerThreads="25"
maxIoThreads="25"/>

None of these help. I'm afraid I need a more specific solution.

Bob

-----Original Message-----
From: Peter Brunone [mailto:Click here to reveal e-mail address]
Sent: Saturday, March 30, 2002 3:11 PM
To: ngfx-oledb
Subject: [ngfx-oledb] RE: Error Trying to Update an Access Database

Bob,

    The solutions below are rather cryptic (as you observed).
Offhand, I'd say just give the ASPNET account Read/Write access to the
.mdb file and its directory. If that doesn't work -- or if you don't
want to do that for whatever reason -- I would recommend option 1 below,
i.e.

|Configure the ASP.NET worker process to run under the SYSTEM account in
|the <processModel> section of the Machine.config file.

    You can find the machine.config on your system drive (I'll just
assume C) in the following directory (version number may be different
for you):

C:\WINNT\Microsoft.NET\Framework\v1.0.3705\CONFIG\machine.config

    There is a <processModel> tag in this XML file in which the
"user" attribute specifies which account to use for the ASP.NET process.
The default is user="machine", which uses the ASPNET account (somewhat
lower security privileges); you can specify an arbitrary user account or
"SYSTEM", which will let the process run as the operating system (which
by default has access to everything).

    Let us know how this works out and which option you decide to
use...

Cheers,

Peter

|-----Original Message-----
|From: Bob Avallone [mailto:Click here to reveal e-mail address]
|Sent: Saturday, March 30, 2002 12:02 PM
|To: ngfx-oledb
|Subject: [ngfx-oledb] Error Trying to Update an Access Database
|
|I try to update an Access Database using an Update query and the
|following code:
|
| Dim comAnyCommand As OleDbCommand
| Dim shoRows As Short
|
|
| Try
| comAnyCommand = New OleDbCommand(pstrSQL, mdcnDatabase)
| shoRows = comAnyCommand.ExecuteNonQuery()
|
|The execute fails the error is:
|
|Operation must use an updateable query.
|
|I found this problem on the knowledge base. This is what it says:
|
|CAUSE
|Because of security concerns, the ASP.NET worker process runs under the
|default ASPNET account. If you do not enable impersonation for an
|application, all of the threads that run the requests for that
|application run under the process account.
|
|This problem occurs because the ASPNET account does not have sufficient
|permissions to connect to or write to an Access database.
|
|RESOLUTION
|To work around this problem, use one of the following methods:
|
|Configure the ASP.NET worker process to run under the SYSTEM account in
|the <processModel> section of the Machine.config file.
|
|For security reasons, Microsoft recommends that you enable
|impersonation on your ASP.NET application. This method works if the
|impersonated user has necessary permissions to the computer and the
|database that you are accessing.
|
|Grant read and write permissions for the "Everyone" group on the
|database and the database folder. This method is not safe; therefore,
|Microsoft does not recommend this method.
|
|The problem is that it's not clear exactly how to implement these
|solutions. What steps do I take?
|
|Bob

| [ngfx-oledb] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-oledb.asp = JOIN/QUIT

Reply to this message...
 
    
Peter Brunone

    The System user already has access to the MDB and directory. Did you give
the ASPNET user that same access? If the userName tag below reads
"machine", then the ASPNET account is the one you need to give access.

    Try giving the "Everyone" group *temporary* Full Control over the directory
and file. If you still get the same error, then we're barking up the wrong
tree. If that's the case,feel free to send all the relevant database code
and we'll take a look.

-Peter

|-----Original Message-----
|From: Bob Avallone [mailto:Click here to reveal e-mail address]
|Sent: Saturday, March 30, 2002 5:06 PM
|To: ngfx-oledb
|Subject: [ngfx-oledb] RE: Error Trying to Update an Access Database
|
|I try giving the System user access to the MDB and the directory. I try
|modified the processModel tag user from "machine" to "system"
|
| <processModel enable="true" timeout="Infinite" idleTimeout="Infinite"
|shutdownTimeout="0:00:05" requestLimit="Infinite"
|requestQueueLimit="5000" restartQueueLimit="10" memoryLimit="60"
|webGarden="false" cpuMask="0xffffffff" userName="system"
|password="AutoGenerate" logLevel="Errors" clientConnectedCheck="0:00:05"
|comAuthenticationLevel="Connect" comImpersonationLevel="Impersonate"
|responseRestartDeadlockInterval="00:09:00"
|responseDeadlockInterval="00:03:00" maxWorkerThreads="25"
|maxIoThreads="25"/>
|
|None of these help. I'm afraid I need a more specific solution.
|
|Bob
|
|-----Original Message-----
|From: Peter Brunone [mailto:Click here to reveal e-mail address]
|Sent: Saturday, March 30, 2002 3:11 PM
|To: ngfx-oledb
|Subject: [ngfx-oledb] RE: Error Trying to Update an Access Database
|
|Bob,
|
|    The solutions below are rather cryptic (as you observed).
|Offhand, I'd say just give the ASPNET account Read/Write access to the
|.mdb file and its directory. If that doesn't work -- or if you don't
|want to do that for whatever reason -- I would recommend option 1 below,
|i.e.
|
||Configure the ASP.NET worker process to run under the SYSTEM account in
||the <processModel> section of the Machine.config file.
|
|    You can find the machine.config on your system drive (I'll just
|assume C) in the following directory (version number may be different
|for you):
|
|C:\WINNT\Microsoft.NET\Framework\v1.0.3705\CONFIG\machine.config
|
|    There is a <processModel> tag in this XML file in which the
|"user" attribute specifies which account to use for the ASP.NET process.
|The default is user="machine", which uses the ASPNET account (somewhat
|lower security privileges); you can specify an arbitrary user account or
|"SYSTEM", which will let the process run as the operating system (which
|by default has access to everything).
|
|    Let us know how this works out and which option you decide to
|use...
|
|Cheers,
|
|Peter
|
||-----Original Message-----
||From: Bob Avallone [mailto:Click here to reveal e-mail address]
||Sent: Saturday, March 30, 2002 12:02 PM
||To: ngfx-oledb
||Subject: [ngfx-oledb] Error Trying to Update an Access Database
||
||I try to update an Access Database using an Update query and the
||following code:
||
|| Dim comAnyCommand As OleDbCommand
|| Dim shoRows As Short
||
|| Try
|| comAnyCommand = New OleDbCommand(pstrSQL, mdcnDatabase)
|| shoRows = comAnyCommand.ExecuteNonQuery()
||
||The execute fails the error is:
||
||Operation must use an updateable query.
||
||I found this problem on the knowledge base. This is what it says:
||
||CAUSE
||Because of security concerns, the ASP.NET worker process runs under the
||default ASPNET account. If you do not enable impersonation for an
||application, all of the threads that run the requests for that
||application run under the process account.
||
||This problem occurs because the ASPNET account does not have sufficient
||permissions to connect to or write to an Access database.
||
||RESOLUTION
||To work around this problem, use one of the following methods:
||
||Configure the ASP.NET worker process to run under the SYSTEM account in
||the <processModel> section of the Machine.config file.
||
||For security reasons, Microsoft recommends that you enable
||impersonation on your ASP.NET application. This method works if the
||impersonated user has necessary permissions to the computer and the
||database that you are accessing.
||
||Grant read and write permissions for the "Everyone" group on the
||database and the database folder. This method is not safe; therefore,
||Microsoft does not recommend this method.
||
||The problem is that it's not clear exactly how to implement these
||solutions. What steps do I take?
||
||Bob

Reply to this message...
 
    
Ken Schaefer (VIP)
The two causes of this problem that I know of are:

a) insufficient priveleges for the relevant account (eg the ASPNet account)
b) your SQL string can't be executed because you're violating some kind of
constraint in the database (eg a foreign key constraint or similar).

As Peter has suggested, try giving the Everyone group full control over both
the actual database file, and the folder that the file is sitting in (this
is so that the Jet engine can create and destory its little .ldb lockfile
that it uses for keeping track of who is using what in the database). If
this solves your problem then you know that the problem is NTFS permissions
based, and you'll have to re-tighten the permissions appropriately.

If you are still getting the error, then (to my mind) it seems like a
problem with whatever SQL statement you are trying to execute - can you post
that please?

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Bob Avallone" <Click here to reveal e-mail address>
Subject: [ngfx-oledb] RE: Error Trying to Update an Access Database

: I try giving the System user access to the MDB and the directory. I try
: modified the processModel tag user from "machine" to "system"
:
: <processModel enable="true" timeout="Infinite" idleTimeout="Infinite"
: shutdownTimeout="0:00:05" requestLimit="Infinite"
: requestQueueLimit="5000" restartQueueLimit="10" memoryLimit="60"
: webGarden="false" cpuMask="0xffffffff" userName="system"
: password="AutoGenerate" logLevel="Errors" clientConnectedCheck="0:00:05"
: comAuthenticationLevel="Connect" comImpersonationLevel="Impersonate"
: responseRestartDeadlockInterval="00:09:00"
: responseDeadlockInterval="00:03:00" maxWorkerThreads="25"
: maxIoThreads="25"/>
:
: None of these help. I'm afraid I need a more specific solution.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply to this message...
 
    
Bob Avallone
When I set Everyone to Full Control, I get a different error "Could not
use ''; file already in use" This occurs when I try to open the data
set. The code is:

Dim myDataTable As DataTable

Dim strEndDate As String
Dim sSQL As String
Dim myDataAdapter As OleDbDataAdapter

Dim sDatabase As String
Dim strProvider As String

Try

myDataAdapter = New OleDbDataAdapter(pstrSQL, mdcnDatabase)
' myDataAdapter = New OleDbDataAdapter("Select * from
Events", mdcnDatabase)
pdsEvents = New DataSet()
myDataAdapter.Fill(pdsEvents, "Events")

Return True
Catch

msErrorMessage = Err.Number & " - " & Err.Description

Return False

Exit Function ' GetContacts
End Try

It fails on the .Fill

Bob Avallone

-----Original Message-----
From: Peter Brunone [mailto:Click here to reveal e-mail address]
Sent: Saturday, March 30, 2002 9:13 PM
To: ngfx-oledb
Subject: [ngfx-oledb] RE: Error Trying to Update an Access Database

    The System user already has access to the MDB and directory.
Did you give the ASPNET user that same access? If the userName tag
below reads "machine", then the ASPNET account is the one you need to
give access.

    Try giving the "Everyone" group *temporary* Full Control over
the directory and file. If you still get the same error, then we're
barking up the wrong tree. If that's the case,feel free to send all the
relevant database code and we'll take a look.

-Peter

|-----Original Message-----
|From: Bob Avallone [mailto:Click here to reveal e-mail address]
|Sent: Saturday, March 30, 2002 5:06 PM
|To: ngfx-oledb
|Subject: [ngfx-oledb] RE: Error Trying to Update an Access Database
|
|I try giving the System user access to the MDB and the directory. I try

|modified the processModel tag user from "machine" to "system"
|
| <processModel enable="true" timeout="Infinite" idleTimeout="Infinite"

|shutdownTimeout="0:00:05" requestLimit="Infinite"
|requestQueueLimit="5000" restartQueueLimit="10" memoryLimit="60"
|webGarden="false" cpuMask="0xffffffff" userName="system"
|password="AutoGenerate" logLevel="Errors"
|clientConnectedCheck="0:00:05" comAuthenticationLevel="Connect"
|comImpersonationLevel="Impersonate"
|responseRestartDeadlockInterval="00:09:00"
|responseDeadlockInterval="00:03:00" maxWorkerThreads="25"
|maxIoThreads="25"/>
|
|None of these help. I'm afraid I need a more specific solution.
|
|Bob
|
|-----Original Message-----
|From: Peter Brunone [mailto:Click here to reveal e-mail address]
|Sent: Saturday, March 30, 2002 3:11 PM
|To: ngfx-oledb
|Subject: [ngfx-oledb] RE: Error Trying to Update an Access Database
|
|Bob,
|
|    The solutions below are rather cryptic (as you observed).
Offhand, I'd
|say just give the ASPNET account Read/Write access to the .mdb file and

|its directory. If that doesn't work -- or if you don't want to do that

|for whatever reason -- I would recommend option 1 below, i.e.
|
||Configure the ASP.NET worker process to run under the SYSTEM account
||in the <processModel> section of the Machine.config file.
|
|    You can find the machine.config on your system drive (I'll just
assume
|C) in the following directory (version number may be different for
|you):
|
|C:\WINNT\Microsoft.NET\Framework\v1.0.3705\CONFIG\machine.config
|
|    There is a <processModel> tag in this XML file in which the
"user"
|attribute specifies which account to use for the ASP.NET process. The
|default is user="machine", which uses the ASPNET account (somewhat
|lower security privileges); you can specify an arbitrary user account
|or "SYSTEM", which will let the process run as the operating system
|(which by default has access to everything).
|
|    Let us know how this works out and which option you decide to
use...
|
|Cheers,
|
|Peter
|
||-----Original Message-----
||From: Bob Avallone [mailto:Click here to reveal e-mail address]
||Sent: Saturday, March 30, 2002 12:02 PM
||To: ngfx-oledb
||Subject: [ngfx-oledb] Error Trying to Update an Access Database
||
||I try to update an Access Database using an Update query and the
||following code:
||
|| Dim comAnyCommand As OleDbCommand
|| Dim shoRows As Short
||
|| Try
|| comAnyCommand = New OleDbCommand(pstrSQL, mdcnDatabase)
|| shoRows = comAnyCommand.ExecuteNonQuery()
||
||The execute fails the error is:
||
||Operation must use an updateable query.
||
||I found this problem on the knowledge base. This is what it says:
||
||CAUSE
||Because of security concerns, the ASP.NET worker process runs under
||the default ASPNET account. If you do not enable impersonation for an
||application, all of the threads that run the requests for that
||application run under the process account.
||
||This problem occurs because the ASPNET account does not have
||sufficient permissions to connect to or write to an Access database.
||
||RESOLUTION
||To work around this problem, use one of the following methods:
||
||Configure the ASP.NET worker process to run under the SYSTEM account
||in the <processModel> section of the Machine.config file.
||
||For security reasons, Microsoft recommends that you enable
||impersonation on your ASP.NET application. This method works if the
||impersonated user has necessary permissions to the computer and the
||database that you are accessing.
||
||Grant read and write permissions for the "Everyone" group on the
||database and the database folder. This method is not safe; therefore,
||Microsoft does not recommend this method.
||
||The problem is that it's not clear exactly how to implement these
||solutions. What steps do I take?
||
||Bob

| [ngfx-oledb] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-oledb.asp = JOIN/QUIT

Reply to this message...
 
 
System.Data.DataSet
System.Data.DataTable
System.Data.OleDb.OleDbCommand
System.Data.OleDb.OleDbDataAdapter




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification