473,396 Members | 2,033 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.

updating a access Database Record

Question about updating a access Database Record!
Normally i'm working with SQLserver, but i have to do this with access and it's not working.

My error is: Operation must use an updateable query.

This is my code:
Dim objCommand As OleDbCommand
Dim strSQLQuery As String

' Our insert command
strSQLQuery = "Update Regios SET Regio=@TextRegio WHERE RegioID=@RegioID "

' Create new command object passing it our SQL insert
' and telling it which connection to use.

objCommand = New OleDbCommand(strSQLQuery, conStoreAdmin)

' Add parameters that our SQL command takes:
objCommand.Parameters.Add(New OleDbParameter("@TextRegio", OleDbType.VarChar, 500))
objCommand.Parameters.Add(New OleDbParameter("@RegioID", OleDbType.Integer))

' Set the values of these parameters:
objCommand.Parameters("@TextRegio").Value = strKAT
objCommand.Parameters("@RegioID").Value = intID

' Open the connection, execute the command, and close the connection.
conStoreAdmin.Open()
objCommand.ExecuteNonQuery()
conStoreAdmin.Close()

Thx

Nov 21 '05 #1
6 1386
On Wed, 2 Feb 2005 15:42:11 +0100, "Fred Geurtsen" <f.********@simstones.nl> wrote:

¤ Question about updating a access Database Record!
¤ Normally i'm working with SQLserver, but i have to do this with access and it's not working.
¤
¤ My error is: Operation must use an updateable query.
¤
¤ This is my code:
¤ Dim objCommand As OleDbCommand
¤ Dim strSQLQuery As String
¤
¤ ' Our insert command
¤ strSQLQuery = "Update Regios SET Regio=@TextRegio WHERE RegioID=@RegioID "
¤
¤ ' Create new command object passing it our SQL insert
¤ ' and telling it which connection to use.
¤
¤ objCommand = New OleDbCommand(strSQLQuery, conStoreAdmin)
¤
¤ ' Add parameters that our SQL command takes:
¤ objCommand.Parameters.Add(New OleDbParameter("@TextRegio", OleDbType.VarChar, 500))
¤ objCommand.Parameters.Add(New OleDbParameter("@RegioID", OleDbType.Integer))
¤
¤ ' Set the values of these parameters:
¤ objCommand.Parameters("@TextRegio").Value = strKAT
¤ objCommand.Parameters("@RegioID").Value = intID
¤
¤ ' Open the connection, execute the command, and close the connection.
¤ conStoreAdmin.Open()
¤ objCommand.ExecuteNonQuery()
¤ conStoreAdmin.Close()

Could be permissions issue on the folder or database file. Is this an ASP.NET application?
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 21 '05 #2
Yes, It is an ASP.NET application, so my access database file can't be
written. Do I need to share and allow changing the folder where my
database is?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #3


"Fred Geurtsen" <fa********@zonnet.nl> wrote in message
news:uk**************@tk2msftngp13.phx.gbl...
Yes, It is an ASP.NET application, so my access database file can't be
written. Do I need to share and allow changing the folder where my
database is?

You also need a primary key.
If you have one then the next thing to try is just executing a hard coded
string and check that doesn't work.

When you write to an access database that user has to create an ldb file in
the same folder as the mdb and be able to write the user locks away to that.
The last user disconnecting also deletes the ldb with recent versions of
access.
There's no database service.

--
Regards,
Andy O'Neill
Nov 21 '05 #4
If it is an ASP.NET app you may even need to edit the machine.config file.

Did you make it work?
"Andy O'Neill" <ao***************@lycos.co.uk> wrote in message
news:9r*************@fe3.news.blueyonder.co.uk...


"Fred Geurtsen" <fa********@zonnet.nl> wrote in message
news:uk**************@tk2msftngp13.phx.gbl...
Yes, It is an ASP.NET application, so my access database file can't be
written. Do I need to share and allow changing the folder where my
database is?

You also need a primary key.
If you have one then the next thing to try is just executing a hard coded
string and check that doesn't work.

When you write to an access database that user has to create an ldb file
in the same folder as the mdb and be able to write the user locks away to
that. The last user disconnecting also deletes the ldb with recent
versions of access.
There's no database service.

--
Regards,
Andy O'Neill

Nov 21 '05 #5
Fred Geurtsen wrote:
Question about updating a access Database Record!
Normally i'm working with SQLserver, but i have to do this with access
and it's not working.

My error is: *Operation must use an updateable query.*
**
This is my code:

Dim objCommand As OleDbCommand
Dim strSQLQuery As String

' Our insert command
strSQLQuery = "Update Regios SET Regio=@TextRegio WHERE RegioID=@RegioID "

' Create new command object passing it our SQL insert
' and telling it which connection to use.

objCommand = New OleDbCommand(strSQLQuery, conStoreAdmin)

' Add parameters that our SQL command takes:
objCommand.Parameters.Add(New OleDbParameter("@TextRegio",
OleDbType.VarChar, 500))
objCommand.Parameters.Add(New OleDbParameter("@RegioID", OleDbType.Integer))

' Set the values of these parameters:
objCommand.Parameters("@TextRegio").Value = strKAT
objCommand.Parameters("@RegioID").Value = intID

' Open the connection, execute the command, and close the connection.
conStoreAdmin.Open()
objCommand.ExecuteNonQuery()
conStoreAdmin.Close()

Thx

I believe when using Access DB you need to use a question mark in the
select query to indicate a parameter.
Nov 21 '05 #6
On Wed, 02 Feb 2005 08:05:00 -0800, Fred Geurtsen <fa********@zonnet.nl> wrote:

¤ Yes, It is an ASP.NET application, so my access database file can't be
¤ written. Do I need to share and allow changing the folder where my
¤ database is?

If you're not using impersonation for your web application (configured via the web.config) then you
need to provide full file access to the folder where the Access database is located for the ASPNET
account. This is the default identity under which your ASP.NET web application executes if you are
not implementing impersonation, and it is a somewhat restricted account.
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 21 '05 #7

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

Similar topics

11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
5
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated...
2
by: barret bonden | last post by:
(closest newsgroup I could find) Error Type: ADODB.Recordset (0x800A0CB3) Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype....
5
by: Hexman | last post by:
I've come up with an error which the solution eludes me. I get the error: >An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in HRTest.exe > >Additional...
1
by: rdemyan via AccessMonster.com | last post by:
My App has 10 or so tables that we provide that contains proprietary data. This data will need to be updated once or twice a year. I would like some comments, suggestions on my proposed strategy...
11
by: bbasberg | last post by:
Hello, I have been struggling with this problem for DAYS and have googled my heart out as well as reading any books I could get my hands on but I cannot find any specific references to my problem....
1
by: talat.riaz | last post by:
Hi All, Here's the scenario : Table 1 : Each record has unique id Table 2: Every time a record in Table 1 is created and/or updated table2 stores each as a seperate record Each time a...
1
by: pyrahna | last post by:
I have an access form that connects to a database on a main server. These forms stay open for a long length of time (a couple hours) and then the user finishes with them and closes the form. The...
4
by: MooVBuff | last post by:
I am new to VB.2005 and to make it worse, I'm switching over from VB 6.0. I have figured out how to programmatically Create a Database and Table and how to add data to an Access database (Two weeks...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.