Discussion Locked

error

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am working on a web application in vb.net:
Why am I getting ?Operation must use an updateable querry? error message at the: da.update statement of the following sub:

Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click

DS.Tables("accounts").Rows(Pos).BeginEdit()
DS.Tables("accounts").Rows(Pos)("ID") = txtID.Text
DS.Tables("accounts").Rows(Pos)("Account_Name") = txtName.Text
DS.Tables("accounts").Rows(Pos)("Account_Reference") = txtReference.Text
DS.Tables("accounts").Rows(Pos)("SubID") = txtSub.Text
DS.Tables("accounts").Rows(Pos).EndEdit()

DA.Update(DS, "Accounts")

End Sub

2 replies

by satheesh karthi

Hi,

By using BeginEdit, U temporarily suspending all other events that are been thrown in case of change. When U say EndEdit it (AcceptChanges). Good. But In your code it seems, U are changing the ID as well, that U can do if its primary key. Then various exceptions are thrown in endedit, that follows like

1. The edit broke a constraint. - ConstraintBrokeException
2. The row belongs to the table and the edit tried to change the value of a read-only column. - ReadonlyException
3. The edit tried to put a null value into a column where AllowDBNull is false - NoNullException.

So check it out

Rgs
Satheesh Karthi

This discussion is closed to new replies.