View Single Post
Old 10-13-2014, 11:08 AM
sirmilt sirmilt is offline
Join Date: Jan 2003
Location: Florida
Posts: 451
Angry Update Doesn't Update

I am using Visual Basic 2010 with an SQL Server2005 Express database. My database table is relatively simple with only six columns but I can't get the database to save.

My form has a DataGridView and 6 Text Boxes all created by dragging data from the data source. everything seems to work fine until I try to Update, using the following code:

Private Sub TblPasswordDetailsBindingNavigatorSaveItem_Click(sender As System.Object, e As System.EventArgs) Handles TblPasswordDetailsBindingNavigatorSaveItem.Click
Me.TblPasswordDetailsTableAdapter.Update(Me.CareTakerDataSet.tblPasswo rdDetails)
MsgBox("Update successful")

Catch ex As Exception
End Try
End Sub

This throws the error: "System.Invalid Operation Exception: Update requires a valid Update Command when passed DataRow collection with modified rows. As you can see my code is taken directly from the MSDN web site. To provide the other details, The Table Adapter, DataSet, table name are correctly entered.

I have tried using this code with my entries directly to the DataGridView and also with the data entry to the associated Text Box controls to no avail, I have gone over the various properties and find nothing.

I am lost, I thought I was following the suggested procedure and can't figure out where the problem comes from. The only difference I see is that I am using SQL Server and Access is used in the example.

Reply With Quote