473,396 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Operation must use an updateable query

I have always been working with SQL Server 2005 for ASP.NET apps but
due to some reasons, had to revert back to MS-Access 2000.

When I try to insert/update a MS-Access DB table (MDB), ASP.NET
generates the following error:

Operation must use an updateable query.

pointing to a line that says

oledbCmd.ExecuteNonQuery()

I am trying to execute a Query (using the OledbCommand object) that
exists in the Access database.

I have gone through heaps of articles to overcome this error &
concluded that the unanimous & most common reason behind this error is
that the directory which houses the Access MDB file doesn't have the
requisite Write & Modify permissions.

I navigated to the directory where the MDB file resides in Windows
Explorer, right-clicked the directory & clicked 'Properties'. Under
the 'Security' tab, I clicked the 'Add' button which opened a dialog
titled 'Select Users or Groups'. In this dialog, I clicked the
'Advanced...' button which opened another dialog with the same title
'Select Users or Groups'. In this dialog, I clicked the 'Find Now'
button which listed the users/groups existing in my machine. ASPNET &
IUSR_MYPC (where 'MYPC' is the machine name) were listed. I selected
both of them - one by one - & gave both of them 'Full Control'
permissions but still the error persists.

Can someone please help me resolve this error? It's driving me nuts
since last more than 3 hours!!

I am working on WinXP Pro SP2.

Jan 27 '07 #1
11 3912
Did you also check that the mdb file itself doesn't have readonly bit set?

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
"Arpan" <ar******@hotmail.comwrote in message
news:11*********************@a34g2000cwb.googlegro ups.com...
>I have always been working with SQL Server 2005 for ASP.NET apps but
due to some reasons, had to revert back to MS-Access 2000.

When I try to insert/update a MS-Access DB table (MDB), ASP.NET
generates the following error:

Operation must use an updateable query.

pointing to a line that says

oledbCmd.ExecuteNonQuery()

I am trying to execute a Query (using the OledbCommand object) that
exists in the Access database.

I have gone through heaps of articles to overcome this error &
concluded that the unanimous & most common reason behind this error is
that the directory which houses the Access MDB file doesn't have the
requisite Write & Modify permissions.

I navigated to the directory where the MDB file resides in Windows
Explorer, right-clicked the directory & clicked 'Properties'. Under
the 'Security' tab, I clicked the 'Add' button which opened a dialog
titled 'Select Users or Groups'. In this dialog, I clicked the
'Advanced...' button which opened another dialog with the same title
'Select Users or Groups'. In this dialog, I clicked the 'Find Now'
button which listed the users/groups existing in my machine. ASPNET &
IUSR_MYPC (where 'MYPC' is the machine name) were listed. I selected
both of them - one by one - & gave both of them 'Full Control'
permissions but still the error persists.

Can someone please help me resolve this error? It's driving me nuts
since last more than 3 hours!!

I am working on WinXP Pro SP2.
Jan 27 '07 #2
Yes Teemu....I did check that......the MDB file is not marked read-
only.

What else can I do? Pleassssssssse give me a concrete solution.

On Jan 27, 8:44 pm, "Teemu Keiski" <jot...@aspalliance.comwrote:
Did you also check that the mdb file itself doesn't have readonly bit set?

--
Teemu Keiski
AspInsider, ASP.NET MVPhttp://blogs.aspadvice.com/jotekehttp://teemukeiski.net

"Arpan" <arpan...@hotmail.comwrote in messagenews:11*********************@a34g2000cwb.go oglegroups.com...
I have always been working with SQL Server 2005 for ASP.NET apps but
due to some reasons, had to revert back to MS-Access 2000.
When I try to insert/update a MS-Access DB table (MDB), ASP.NET
generates the following error:
Operation must use an updateable query.
pointing to a line that says
oledbCmd.ExecuteNonQuery()
I am trying to execute a Query (using the OledbCommand object) that
exists in the Access database.
I have gone through heaps of articles to overcome this error &
concluded that the unanimous & most common reason behind this error is
that the directory which houses the Access MDB file doesn't have the
requisite Write & Modify permissions.
I navigated to the directory where the MDB file resides in Windows
Explorer, right-clicked the directory & clicked 'Properties'. Under
the 'Security' tab, I clicked the 'Add' button which opened a dialog
titled 'Select Users or Groups'. In this dialog, I clicked the
'Advanced...' button which opened another dialog with the same title
'Select Users or Groups'. In this dialog, I clicked the 'Find Now'
button which listed the users/groups existing in my machine. ASPNET &
IUSR_MYPC (where 'MYPC' is the machine name) were listed. I selected
both of them - one by one - & gave both of them 'Full Control'
permissions but still the error persists.
Can someone please help me resolve this error? It's driving me nuts
since last more than 3 hours!!
I am working on WinXP Pro SP2.- Hide quoted text -- Show quoted text -
Jan 27 '07 #3
You could always start by giving everyone write access to the directory, and
in IIS ensure the web app is write enabled for that directory - then once
you have it working for everyone, start limiting who can access the
directory with write permissions

--
Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog
"Arpan" <ar******@hotmail.comwrote in message
news:11**********************@v45g2000cwv.googlegr oups.com...
Yes Teemu....I did check that......the MDB file is not marked read-
only.

What else can I do? Pleassssssssse give me a concrete solution.

On Jan 27, 8:44 pm, "Teemu Keiski" <jot...@aspalliance.comwrote:
>Did you also check that the mdb file itself doesn't have readonly bit
set?

--
Teemu Keiski
AspInsider, ASP.NET
MVPhttp://blogs.aspadvice.com/jotekehttp://teemukeiski.net

"Arpan" <arpan...@hotmail.comwrote in
messagenews:11*********************@a34g2000cwb.g ooglegroups.com...
>I have always been working with SQL Server 2005 for ASP.NET apps but
due to some reasons, had to revert back to MS-Access 2000.
When I try to insert/update a MS-Access DB table (MDB), ASP.NET
generates the following error:
Operation must use an updateable query.
pointing to a line that says
oledbCmd.ExecuteNonQuery()
I am trying to execute a Query (using the OledbCommand object) that
exists in the Access database.
I have gone through heaps of articles to overcome this error &
concluded that the unanimous & most common reason behind this error is
that the directory which houses the Access MDB file doesn't have the
requisite Write & Modify permissions.
I navigated to the directory where the MDB file resides in Windows
Explorer, right-clicked the directory & clicked 'Properties'. Under
the 'Security' tab, I clicked the 'Add' button which opened a dialog
titled 'Select Users or Groups'. In this dialog, I clicked the
'Advanced...' button which opened another dialog with the same title
'Select Users or Groups'. In this dialog, I clicked the 'Find Now'
button which listed the users/groups existing in my machine. ASPNET &
IUSR_MYPC (where 'MYPC' is the machine name) were listed. I selected
both of them - one by one - & gave both of them 'Full Control'
permissions but still the error persists.
Can someone please help me resolve this error? It's driving me nuts
since last more than 3 hours!!
I am working on WinXP Pro SP2.- Hide quoted text -- Show quoted text -

Jan 27 '07 #4

On Jan 27, 5:16 pm, "Arpan" <arpan...@hotmail.comwrote:
Yes Teemu....I did check that......the MDB file is not marked read-
only.

What else can I do? Pleassssssssse give me a concrete solution.

On Jan 27, 8:44 pm, "Teemu Keiski" <jot...@aspalliance.comwrote:

http://support.microsoft.com/kb/q175168/
A second cause of this error is that the database was not opened with
the correct MODE for writing. If you perform the Open on the
Connection object, you use the Mode property to indicate the
permissions on the connection as shown here:

SQL = "UPDATE Products Set UnitPrice = 2;"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Mode = 3 '3 = adModeReadWrite
Conn.Open "myDSN"
Conn.Execute(SQL)
Conn.Close

Jan 27 '07 #5
Well, I could unearth the cause of the error but couldn't resolve it.

Actually the Query I am invoking in MS-Access is this:

UPDATE FirstGlobal SET Quantity = (SELECT Quantity FROM FirstGlobal
WHERE ClientName = [ClientName1] AND Scrip = [Scrip1] AND ContNoteNo =
[ContNoteNo1]) + [AddQty1]
WHERE ClientName=[ClientName1] AND Scrip=[Scrip1] AND
ContNoteNo=[ContNoteNo1];

When I run the above Query by clicking the 'Run' button (with the
exclamation mark) while I am in SQL View in MS-Access, then I am first
prompted to enter a value for the input parameter 'ClientName1', then
I am prompted to enter a value for the input parameter 'Scrip1', then
I am prompted to enter a value for the input parameter 'ContNoteNo1' &
finally I am prompted to enter a value for the input parameter
'AddQty1'.

At this point, Access generates the 'Operation must use an updateable
query' error.

After some tests, I concluded that the source of the error is the sub-
query 'SELECT Quantity FROM FirstGlobal.......'. If I replace the sub-
query with any number, say, 100 & then add it to the parameter
'AddQty1', then the above Query runs perfectly.

But what is wrong with the sub-query?

Please note that the sub-query will ALWAYS RETURN only ONE VALUE &
will NEVER BE NULL.....that is for sure.

On Jan 27, 10:23 pm, "Alexey Smirnov" <alexey.smir...@gmail.com>
wrote:
On Jan 27, 5:16 pm, "Arpan" <arpan...@hotmail.comwrote:
Yes Teemu....I did check that......the MDB file is not marked read-
only.
What else can I do? Pleassssssssse give me a concrete solution.
On Jan 27, 8:44 pm, "Teemu Keiski" <jot...@aspalliance.comwrote:http://support.microsoft.com/kb/q175168/

A second cause of this error is that the database was not opened with
the correct MODE for writing. If you perform the Open on the
Connection object, you use the Mode property to indicate the
permissions on the connection as shown here:

SQL = "UPDATE Products Set UnitPrice = 2;"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Mode = 3 '3 = adModeReadWrite
Conn.Open "myDSN"
Conn.Execute(SQL)
Conn.Close
Jan 27 '07 #6
It seems the JET DB Engine treats any query with a sub-query as a non-
updateable query which was why Access was generating the error. I
changed the query to overcome the error:

UPDATE FirstGlobal AS FG1 INNER JOIN FirstGlobal AS FG2 ON
(FG1.ClientName = FG2.ClientName) AND (FG1.Scrip = FG2.Scrip) AND
(FG1.ContNoteNo = FG2.ContNoteNo) SET FG1.Quantity = FG1.Quantity +
[AddQty1]
WHERE FG1.ClientName=[ClientName1] AND FG1.Scrip=[Scrip1] AND
FG1.ContNoteNo=[ContNoteNo1];
On Jan 28, 12:51 am, "Arpan" <arpan...@hotmail.comwrote:
Well, I could unearth the cause of the error but couldn't resolve it.

Actually the Query I am invoking in MS-Access is this:

UPDATE FirstGlobal SET Quantity = (SELECT Quantity FROM FirstGlobal
WHERE ClientName = [ClientName1] AND Scrip = [Scrip1] AND ContNoteNo =
[ContNoteNo1]) + [AddQty1]
WHERE ClientName=[ClientName1] AND Scrip=[Scrip1] AND
ContNoteNo=[ContNoteNo1];

When I run the above Query by clicking the 'Run' button (with the
exclamation mark) while I am in SQL View in MS-Access, then I am first
prompted to enter a value for the input parameter 'ClientName1', then
I am prompted to enter a value for the input parameter 'Scrip1', then
I am prompted to enter a value for the input parameter 'ContNoteNo1' &
finally I am prompted to enter a value for the input parameter
'AddQty1'.

At this point, Access generates the 'Operation must use an updateable
query' error.

After some tests, I concluded that the source of the error is the sub-
query 'SELECT Quantity FROM FirstGlobal.......'. If I replace the sub-
query with any number, say, 100 & then add it to the parameter
'AddQty1', then the above Query runs perfectly.

But what is wrong with the sub-query?

Please note that the sub-query will ALWAYS RETURN only ONE VALUE &
will NEVER BE NULL.....that is for sure.

On Jan 27, 10:23 pm, "Alexey Smirnov" <alexey.smir...@gmail.com>
wrote:
On Jan 27, 5:16 pm, "Arpan" <arpan...@hotmail.comwrote:
Yes Teemu....I did check that......the MDB file is not marked read-
only.
What else can I do? Pleassssssssse give me a concrete solution.
On Jan 27, 8:44 pm, "Teemu Keiski" <jot...@aspalliance.comwrote:http://support.microsoft.com/kb/q175168/
A second cause of this error is that the database was not opened with
the correct MODE for writing. If you perform the Open on the
Connection object, you use the Mode property to indicate the
permissions on the connection as shown here:
SQL = "UPDATE Products Set UnitPrice = 2;"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Mode = 3 '3 = adModeReadWrite
Conn.Open "myDSN"
Conn.Execute(SQL)
Conn.Close- Hide quoted text -- Show quoted text -
Jan 27 '07 #7


On Jan 27, 8:51 pm, "Arpan" <arpan...@hotmail.comwrote:
Well, I could unearth the cause of the error but couldn't resolve it.

Actually the Query I am invoking in MS-Access is this:

UPDATE FirstGlobal SET Quantity = (SELECT Quantity FROM FirstGlobal
WHERE ClientName = [ClientName1] AND Scrip = [Scrip1] AND ContNoteNo =
[ContNoteNo1]) + [AddQty1]
WHERE ClientName=[ClientName1] AND Scrip=[Scrip1] AND
ContNoteNo=[ContNoteNo1];

When I run the above Query by clicking the 'Run' button (with the
exclamation mark) while I am in SQL View in MS-Access, then I am first
prompted to enter a value for the input parameter 'ClientName1', then
I am prompted to enter a value for the input parameter 'Scrip1', then
I am prompted to enter a value for the input parameter 'ContNoteNo1' &
finally I am prompted to enter a value for the input parameter
'AddQty1'.

At this point, Access generates the 'Operation must use an updateable
query' error.

man, your problem is not related to
microsoft.public.dotnet.framework.aspnet

And your sql-query is wrong.
After some tests, I concluded that the source of the error is the sub-
query 'SELECT Quantity FROM FirstGlobal.......'. If I replace the sub-
query with any number, say, 100 & then add it to the parameter
'AddQty1', then the above Query runs perfectly.

But what is wrong with the sub-query?

Please note that the sub-query will ALWAYS RETURN only ONE VALUE &
will NEVER BE NULL.....that is for sure.
How do you want ASP.NET to execute your query if it has unknown values
like [ClientName1]???

I guess you wanna do e.g.

.....WHERE ClientName = 'John'.....

that means you need to pass that value into query BEFORE you do your

oledbCmd.ExecuteNonQuery()

In this case you need following

string clientName = "John";
string sql = String.Format("SELECT Quantity FROM FirstGlobal....WHERE
ClientName = '{0}'....., clientName);

......

oledbCmd.ExecuteNonQuery();

Jan 27 '07 #8
Aside from the mentioned fixes to your actual SQL Statetement, you need to
ensure that the folder housing the MDB file has write access from your
application. MS Access creates an xxx.LDB file for locking, and if it cannot
write this file, that's the error you will get.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Arpan" wrote:
I have always been working with SQL Server 2005 for ASP.NET apps but
due to some reasons, had to revert back to MS-Access 2000.

When I try to insert/update a MS-Access DB table (MDB), ASP.NET
generates the following error:

Operation must use an updateable query.

pointing to a line that says

oledbCmd.ExecuteNonQuery()

I am trying to execute a Query (using the OledbCommand object) that
exists in the Access database.

I have gone through heaps of articles to overcome this error &
concluded that the unanimous & most common reason behind this error is
that the directory which houses the Access MDB file doesn't have the
requisite Write & Modify permissions.

I navigated to the directory where the MDB file resides in Windows
Explorer, right-clicked the directory & clicked 'Properties'. Under
the 'Security' tab, I clicked the 'Add' button which opened a dialog
titled 'Select Users or Groups'. In this dialog, I clicked the
'Advanced...' button which opened another dialog with the same title
'Select Users or Groups'. In this dialog, I clicked the 'Find Now'
button which listed the users/groups existing in my machine. ASPNET &
IUSR_MYPC (where 'MYPC' is the machine name) were listed. I selected
both of them - one by one - & gave both of them 'Full Control'
permissions but still the error persists.

Can someone please help me resolve this error? It's driving me nuts
since last more than 3 hours!!

I am working on WinXP Pro SP2.

Jan 27 '07 #9

On Jan 27, 10:48 pm, Peter Bromberg [C# MVP]
<pbromb...@yahoo.yabbadabbadoo.comwrote:
Aside from the mentioned fixes to your actual SQL Statetement, you need to
ensure that the folder housing the MDB file has write access from your
application. MS Access creates an xxx.LDB file for locking, and if it cannot
write this file, that's the error you will get.
Peter, he has already set the full control for IUSR on it.

Jan 27 '07 #10
It may not be running under IUsr_machinename. More likely, the ASPNET account.

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Alexey Smirnov" wrote:
>
On Jan 27, 10:48 pm, Peter Bromberg [C# MVP]
<pbromb...@yahoo.yabbadabbadoo.comwrote:
Aside from the mentioned fixes to your actual SQL Statetement, you need to
ensure that the folder housing the MDB file has write access from your
application. MS Access creates an xxx.LDB file for locking, and if it cannot
write this file, that's the error you will get.

Peter, he has already set the full control for IUSR on it.

Jan 27 '07 #11


I agree it needs an ASP.NET user account on the database folder.
Give it write permissions. Also, in case your Access db has a no-write
switch somewhere deep in its bowels, copy the tables to a
brand new Access mdb that has no such hang-ups. IMHO.
wawens

Jan 28 '07 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Frustrated | last post by:
This is the error that I get: Operation must use an updateable query. It worked previously before I installed Jet 4.0 SP 8 b/c Access 2003 requested it. Database is in Access 2002 format. ...
8
by: Tom wilson | last post by:
This is driving me nuts. I'm trying to update an Excel spreadsheet using ADO.Net and Oledb in VB.Net. The connection is open, the adapter is connected and the dataset is loaded. Here's the code...
6
by: ano1optimist | last post by:
I have been running these queries in Access 2000 with no problems. This week, I had to install Access 2003 to create some runtime versions for another application, and now I keep getting "operation...
4
by: MDW | last post by:
Hey all. I'm confused. I'm trying to add a single record into an Access 2000 database using ASP.Net. Here is the code: objConn = New OleDbConnection(strConnect) objConn.Open objCommand =...
606
by: Neil Zanella | last post by:
Hello, I am trying to update an MS access database from ASP.NET. I am using IIS on Windows XP Pro. I can issue SELECT statements from ASP.NET using ADO.NET but I cannot seem to be able to carry...
2
by: SheryMich | last post by:
Hi - I am having a bit of a problem with the insert into a database. When I go to insert a record into an un-keyed, single table Access database, I get the aforementioned ''Operation Must Use an...
8
by: Jim in Arizona | last post by:
I've been using an example out of a book to be able to edit the rows in a database. I am getting the following error: ========================================================...
1
by: Muskito | last post by:
HELP!!! Hello All, I'm using VB.net 2003 and trying to update data in Excel worksheet. The program selects data from the excel, updates something in the MSSQL DB and then tries to update...
1
by: pavya | last post by:
Hi, I have developed one Web application. At that time my system had a FAT file system on it and this application worked properly. But now i have converted FAT file system to NTFS file system and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.