473,626 Members | 3,216 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Execut eNonQuery()

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 3948
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******@hotma il.comwrote in message
news:11******** *************@a 34g2000cwb.goog legroups.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.Execut eNonQuery()

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...@aspalli ance.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...@hotma il.comwrote in messagenews:11* *************** *****@a34g2000c wb.googlegroups .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.Execut eNonQuery()
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******@hotma il.comwrote in message
news:11******** **************@ v45g2000cwv.goo glegroups.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...@aspalli ance.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...@hotma il.comwrote in
messagenews:11 *************** ******@a34g2000 cwb.googlegroup s.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.Execut eNonQuery()
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...@hotma il.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...@aspalli ance.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.CreateOb ject("ADODB.Con nection")
Conn.Mode = 3 '3 = adModeReadWrite
Conn.Open "myDSN"
Conn.Execute(SQ L)
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...@hotma il.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...@aspalli ance.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.CreateOb ject("ADODB.Con nection")
Conn.Mode = 3 '3 = adModeReadWrite
Conn.Open "myDSN"
Conn.Execute(SQ L)
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...@hotma il.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...@hotma il.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...@aspalli ance.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.CreateOb ject("ADODB.Con nection")
Conn.Mode = 3 '3 = adModeReadWrite
Conn.Open "myDSN"
Conn.Execute(SQ L)
Conn.Close- Hide quoted text -- Show quoted text -
Jan 27 '07 #7


On Jan 27, 8:51 pm, "Arpan" <arpan...@hotma il.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.publi c.dotnet.framew ork.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.Execut eNonQuery()

In this case you need following

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

......

oledbCmd.Execut eNonQuery();

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.Execut eNonQuery()

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...@yaho o.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

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

Similar topics

3
14039
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. This is what I'm doing.
8
902
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 in question: myDataRow = myDataSet.Tables(0).Rows(RowNum) myDataRow(ColumnCount) = Ailment Adapter.UpdateCommand = New OleDbCommand("UPDATE SET F" & ColumnCount & " = '" & Ailment & "' where F1 = " & RowNum & "", Conn)...
6
7557
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 must be an updateable query" messages when I try to run the same old queries. Here is a sample of one that is no longer working: UPDATE Personnel INNER JOIN dbo_personnel ON .= dbo_personnel. SET personnel. = dbo_personnel.,...
4
6498
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 = New OleDbCommand("INSERT INTO LOGIN_MASTER (LOGIN_ID, PWD, F_NAME, L_NAME, TYPE_ID) VALUES ('" & strEmail & "','" & strPwd & "','" &
606
14522
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 out INSERT statements. Here is the error which I am getting: Exception Details: System.Data.OleDb.OleDbException: Operation must use an updateable query.
2
7508
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 Updateable Query' error. Points: - The database is in my local temp directory, not inetpub - The directory has read/write permissions - The database has read/write permissions - I created another version of the dbase and tried to reference it...
8
2998
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: ======================================================== ======================================================== Server Error in '/' Application. -------------------------------------------------------------------------------- Operation must use an updateable query. Description: An unhandled exception occurred during...
1
3574
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 something back to the excel worksheet. My problem is that i'm having this annoying exception: "Operation must
1
2749
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 whenever i am trying to run this application then it through the exception. I have used MS Access as a database. The error is as follows... Server Error in '/ASG' Application....
0
8268
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8202
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8707
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8366
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8510
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7199
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5575
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4202
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.