Question Updatine Access DB with VB basic 2008

NCombs

Member
Joined
Jun 1, 2012
Messages
9
Programming Experience
1-3
I have a datagrid that is loaded from a data source called ManualKanBanDataSet. The Access DB is ManualKanban, the table is "Parts". I've set the column properties of the column I want to change to readonly=false.

I make changes to the data in the datagrid, click my update button and nothing updates. here is the update code:

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Try
Me.Validate()
Me.ManualKanbanDataSet.AcceptChanges()
Me.PartsTableAdapter.Update(Me.ManualKanbanDataSet.Parts)
MsgBox("Update successful")
Catch ex As Exception
MsgBox("Update failed")
End Try
End Sub

I get an "Update Successful, but it really doesn't update.
Help!
 
Guess your database needs a table adapter manager. Try codes as bellow:

Me.TableAdapterManager1.UpdateAll(Data1DataSet)

Here it works. Hope that it helps.
 
I don't have a "TableAdpaterManager1". All I did was paste your code, changing the "Data1DataSet" to "ManualKanbanDataset". I get

TableAdapterManager1 is not a member of "ManualKanbanForm1"
 
If you have bind your database to your datagrid, then you would find TableAdapterManager in the toolbox components. If so, double click on it and it would added to your form, the you can use the code as mentioned above. Every database which binds to a datagrid has a TableAdapterManager.
 
Last edited:
I can't get it to like DataAdapter1.Update(DataSet1, "Table1")

My code looks like: PartsTableAdapter.Update(ManualKanbanDataSet, "Parts")

It says Overload Resolution Failed Because No Accessible 'Update' accepts this number of arguments
 
Update failed.
I now have:
Try
Me.Validate()
REM Me.PartsTableAdapter.Update(Me.ManualKanbanDataSet.Parts)
Me.PartsTableAdapter.Update(CType(Me.PartsBindingSource.DataSource, DataTable))
MsgBox(
"Update successful")
Catch ex As Exception
MsgBox(
"Update failed")
End Try
 
Change it to:

Try
'''Remove validate <<<
Me.ManualKanbanDataSet.Update(CType(Me.ManualKanbanDataSetBindingSource.DataSource, Me.ManualKanbanDataSet.Parts)) <<< Change
MsgBox("Update successful")
Catch ex As Exception
MsgBox(ex.Message) <<< Change
End
Try

And then tell me the error message if it did not work.
 
Last edited:
Me.PartsTableAdapter.Update(CType(Me.PartsBindingSource.DataSource, Me.ManualKanbanDataSet.Parts))

I doesn't like the "green "me". Says keyword does not name a type.
 
I Edited my post

Me.YourDataTableAdapter.Update(CType(Me.YourDataBasebindingSource.DataSource, YourDataTable))
 
Sorry I;m being so dense. I'm new at this. It's not likeing my data table name... "Parts"

Me.PartsTableAdapter.Update(CType(Me.PartsBindingSource.DataSource, Parts))
REM Me.YourDataTableAdapter.Update(CType(Me.YourDataBasebindingSource.DataSource, YourDataTable))
 
I have a DataBase named Data1DataSet which has a Table named Users.

Well in my codes this works correctly, just be patient and try it again carefully. LOL

Me.UsersTableAdapter.Update(CType(Me.UsersBindingSource.DataSource, Data1DataSet.UsersDataTable))

Note: tell me the error message
 
Code is valid now.. but it fails. Error 5. "Update requires a valid UpdateCommand when passed DataRow collection with modified rows."
 
Back
Top