Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with datagrid update code

Status
Not open for further replies.

dbsquared

Programmer
Nov 7, 2002
175
US
i keep getting the error below

Code:
Operation must use an updateable query. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.OleDb.OleDbException: Operation must use an updateable query.

Source Error: 
Line 662:            adpRed.Update(MyDataSet)

I have edit buttons, cancel buttons and ok buttons however the most important one the update button isn't working. Here is my code for the project:

Code:
Private Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click
        ' Code to respond to the Click event of the UPDATE button:
        ' Desc: Updates the underlying database, then rebinds.
        ' Add error handling code as appropriate.
        If DataExists() = False Then Exit Sub
        adpRed.Update(DataRetrieve)
        dgRed.DataSource = DataRetrieve()
        dgRed.DataBind()
        cmdUpdate.Visible = False

End Sub
Public Function DataRetrieve() As DataSet
        Return CType(Session.Item("__Data"), DataSet)
End Function

i got the code from so if i understand everything right what I have is a session copy of my dataset and I am using that to manipulate my data. i am not sure why it wont update the database any help would be greatly appreciated.


To go where no programmer has gone before.
 
Are you using Microsoft Access as the db in this test?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
yes I am is that the problem?

To go where no programmer has gone before.
 
Generally, when you get a "Operation must use an updateable query" it's to do with Access and it sometimes has various different meanings.

Personally, I would never use Access for any kind of back end, especially not for a web site. If you want to use something for testing, I would suggest using something like MySQL or SQL Server (there is a free express variation of this available from the Microsoft site).


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
so you are saying this is an access issue the database I have is very small the whole thing is only 400K so we didn't want to have to spend the time for one little db. We are considering converting to Oracle would this fix my issue?
BTW Thank you very much for your responses.


To go where no programmer has gone before.
 
The error is a Microsoft Access error, so in that respect, yes it is an issue with Access.

Unfortunately, "Operation must use an updateable query" doesn't really give much insight into the actual problem (reading that error would suggest something like you aren't running an update query). In reality, the error is more likely to suggest that something else is wrong; perhaps security settings for example.

If you do have another database ready to use, I would suggest using it, as Access (in my opinion and experience) produces far too many problems that other databases cope perfectly well with.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I've done some research and all i've come up with is that access is updateable and this shouldn't be causing any problems as others use access in the same way that I am.

To go where no programmer has gone before.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top