0

Could someone help find out why do both MS ACCESS Datasource and DGView loose data after insert then restart the application using the following code:

  Me.MyTableAdapter.Insert(Me.TextBox1.Text, Me.TextBox2.Text, Me.TextBox3.Text)
  Me.MyTableAdapter.Fill(Me.MyDataSet.MyTable)
  Me.SaveButton.PerformClick()

It actually happens when I restart my application, but everything looks fine at runtime.

Backalife
  • 3
  • 3
  • 1
    You have not shown enough code to be helpful. What does the SaveButton do? – Steve Aug 08 '14 at 14:53
  • Oh Yes! Sorry about that. that button is the same the default BindingNavigatorSaveButton that I have just renamed for my project. – Backalife Aug 08 '14 at 19:26
  • Not really sure what your doing based on your code but I have to assume you are using some type of database automation tool that creates most of the code for you. With that in mind and knowing how most of these things work, I assume that when your table adapter fills the table, it must clear the data in there first. Because of that, your code tells me that the record you inserted was cleared out when you filled it. Try switching those lines around. – Steve Aug 08 '14 at 20:28
  • Hurray! I got the answer from this thread here: [link]http://stackoverflow.com/questions/17551731/vb-net-and-microsoft-access-old-table-entries-stuck-in-datagridview?rq=1 Thanks for trying to help Steve much appreciated. – Backalife Aug 09 '14 at 01:07

0 Answers0