LINQ insertonsubmit deletes all records

68 Views Asked by At

When I start a fresh debug of my windows form app I can add multiple records into the "klant" table with no problem. They are all saved inside the coupled SQL database. When I Quit debugging and restart the app and I add 1 new record all previous records are deleted and that one new record is now the first record inside the table.. If I add multiple records the previous records are also gone

the code is simple:

Public Class DALKlant
  Dim dc As New DumbbellDataContext
  Dim klant As New klant

  Public Sub AddKlant(ByVal klant As klant)
    dc.klants.InsertOnSubmit(klant)
    dc.SubmitChanges()
  End Sub
End Class

Edit: at first I wasn't able to save any data at all, I had to redirect the connection string towards the mdf. in the bin/debug/app_data folder. Don't know if this can be related with the problem.

0

There are 0 best solutions below