472,958 Members | 2,555 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 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 1369
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.