0
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    'TODO: This line of code loads data into the 'Database4DataSet.Table1' table. You can move, or remove it, as needed.
    Me.Table1TableAdapter.Fill(Me.Database4DataSet.Table1)

End Sub

Private Sub BtnPrevious_Click(sender As Object, e As EventArgs) Handles BtnPrevious.Click
    Table1BindingSource.MovePrevious()
End Sub

Private Sub btnfirst_Click(sender As Object, e As EventArgs) Handles btnfirst.Click
    Table1BindingSource.MoveFirst()
End Sub

Private Sub BtnNext_Click(sender As Object, e As EventArgs) Handles BtnNext.Click
    Table1BindingSource.MoveNext()
End Sub

Private Sub BtnLast_Click(sender As Object, e As EventArgs) Handles BtnLast.Click
    Table1BindingSource.MoveLast()
End Sub

Private Sub btnadd_Click(sender As Object, e As EventArgs) Handles btnadd.Click
    Table1BindingSource.AddNew()
End Sub

Private Sub btndelete_Click(sender As Object, e As EventArgs) Handles btndelete.Click
    Table1BindingSource.RemoveCurrent()
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    Try
        Me.Validate()
        Me.Table1BindingSource.EndEdit()
        Me.Table1TableAdapter.Update(Me.Database4DataSet)
        MsgBox("Your information has been saved successfully")
    Catch ex As Exception
        MsgBox("Please try again")
    End Try

End Sub

Hi i am trying to create a simple vb application that connects to a Microsoft access database that stores basic information of student name, id number and result. my code is working to an extent but when i run the program and add new records the new data i entered saves no problem and i can see while the program is running but when i stop de bugging and start de bugging again the new information i added to the database the last time doesn't appear. only the information that i inputted originally into the database through the access file show up. any info or help would be appreciated.

KDD
  • 41
  • 1
  • 5
  • Typical situation caused by a database file added to your project files with the property Copy To Output Directory set to Copy Always. (And remember that when debugging the database is located in the folder BIN\DEBUG) – Steve Mar 25 '18 at 19:31
  • how do i ifix this thanks steve – KDD Mar 25 '18 at 19:33
  • [Why saving changes to a Database fails](https://stackoverflow.com/questions/17147249/why-saving-changes-to-a-database-fails) – Steve Mar 25 '18 at 19:33
  • i changed it to copy if newer. the new records i added when de bugging saved properly. if i delete a record now when de bugging its still comes up when i stop and de bug again – KDD Mar 25 '18 at 19:41
  • Look at the link again - the last paragraph. – wazz Mar 26 '18 at 07:45

0 Answers0