Hi, i need some help if possible.
I designed a software on vb 2012 with a local access 2010 database, it runs ok,it add's delete and changes record's. However when i start the software it deletes the added records on the previous session. the software is designed with the dataset's. I suppose that the error is on the fill that runs on the form.load. But i can't see the error.

     Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

            If MilitaresTableAdapter.Connection.State = ConnectionState.Closed Or MilitaresTableAdapter.Connection.State = ConnectionState.Broken Then
                Me.MilitaresTableAdapter.Connection.Open()
                Me.MilitaresTableAdapter.GetData()
            Else
                Me.MilitaresTableAdapter.GetData()
                Me.MilitaresTableAdapter.Fill(Me.UCCESCALASDataSet.Militares)
            End If


            Splash.Show()
            Dim user As String
            Dim data As String
            data = Date.Today
            user = My.User.Name
            If user = "RNSI\" + "g1960931" Or user = "RNSI\" + "g1991037" Or user = "RNSI\" + "g1880220" Then
                Label4.Text = user
                Label6.Text = data
            Else
                MsgBox("Utilizador Não Autorizado", MsgBoxStyle.Critical)
                End
            End If
        End Sub

Hi,

Did you specify Update, Delete and InsertCommands for your DataAdapter?
InsertCommand

DeleteCommand

UpdateCommand

This will allow you to push your data changes back to the database. If you haven't what is actually happening is the data is being changed in the system memory (Dataset) but not on the actual database. Hence when you reload the data from the database, you do not have the changes as they were only in memory.

Edited 3 Years Ago by G_Waddell

yes, i did.

 Me.Validate()
 Me.BindingSource1.EndEdit()
 Me.UCCESCALASDataSet.Militares.NewMilitaresRow()
 Me.MilitaresTableAdapter.insert(idord, Nom, post, mat, False, cozi, ucc1, lingue, pbispo, mot, trc, False, False, False)
 Me.UCCESCALASDataSet.AcceptChanges()

Ok so with your project open make a change. Then look up that record in the database, has the change carried through?

This article has been dead for over six months. Start a new discussion instead.