Hi Rod,
Well I thought I could avoid making this post; but after several days of reading and trying out code I have to get help.
My problem is that I can not seem to update a table in the data base. This is what I have done:
1- I have a .mdb file that has six tables. ( Created and used with VB6).
2- In my .net project I sucessfully used the Data Source and loaded the .mdb fle and was able to view all the tables and their contents.
The data file name is
MailList and one of the tables is named
Category.
3- My Form1 has a Tab Control with several tabs.
4- The Second tab has a Button control and a Data Grid control with the following Properties:
DataSource set to CategoryTableBindingSource
EitMode set to EditOnKeyStroke
ReadOnly = False
SelectionMode = CellSelect
The DataGrid is setup to show only one column.
5- The Data Set name = Mail_ListDataSet
6- The Table Adapter name = CategoryTableTableAdapter
7- The CategoryTableBindingSource DataMember = CategoryTable and the DataSource = Mail_ListDataSet.
8- The button's click event has the following code:
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Mail_ListDataSet.CategoryTable.AcceptChanges()
CategoryTableTableAdapter.Update(Mail_ListDataSet.CategoryTable)
End Sub
When I run the proram with Debug (and also in the distributed version) the DataGrid does get loaded and all the rows are displayed. I can edit the rows and also add rows; however when I click the SAVE buton the changes are not transfered to the data base file.
My
VB.net is the 2010 Express version!
What am I doing wrong?
(This
VB.net reminds me of COBOL, a writers cramp language; I am glad the
VB.net has the IntelliSense)
Martin