I have a form that when a user fires a buttonclick event that I want to be able to capture any edits/changes that he's made to the dataset that fills a tableadapter. Here is the code I have currently:
and when I debug this, I get an error when I reach this line of code:
the error being this:
Update requires a valid UpdateCommand when passed DataRow collection with modified rows.
The table does have a primary key, and I've seen a lot of people talk about refreshing the data table to make this work, but because am using a temp database, I'd have to programmatically put that in my code somewhere, or is that not the problem at all?
Thank you
Doug
VB.NET:
Public Class ExceptionEdit
Private Sub ExceptionEdit_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'MDRDataSet.scratchpad3' table. You can move, or remove it, as needed.
Me.Scratchpad3TableAdapter.Fill(Me.MDRDataSet.scratchpad3)
Exceptioncopy()
End Sub
Private Sub SaveExceptionButton(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles saveexceptionsButton.Click
Try
Me.Validate()
Me.Scratchpad3BindingSource.EndEdit()
Me.Scratchpad3TableAdapter.Update(Me.MDRDataSet.scratchpad3)
MsgBox("Update successful")
Catch ex As Exception
MsgBox("Update failed")
End Try
Me.Close()
ExceptionsFinal.Show()
End Sub
and when I debug this, I get an error when I reach this line of code:
VB.NET:
Me.Scratchpad3TableAdapter.Update(Me.MDRDataSet.scratchpad3)
Update requires a valid UpdateCommand when passed DataRow collection with modified rows.
The table does have a primary key, and I've seen a lot of people talk about refreshing the data table to make this work, but because am using a temp database, I'd have to programmatically put that in my code somewhere, or is that not the problem at all?
Thank you
Doug