|
-
May 11th, 2020, 10:53 AM
#1
Thread Starter
Lively Member
Access Database Saving
Hello!
I have done a bit of searching around but can't seem to find anyone who has asked a simular question.
Everything works, I can add a new entry to my database and save it. Close the debug, reopen it and the entry will still be there. The issue comes when I open the actual database in the project file with Access, it doesn't show the new entries, and if I run the debug again - the new entries that had been saved before are gone.
It's as if by opening the Access Database the database is put back to how it was before Visual Studio got a hold of it? I would like to be able to open the database in case anything ever needs to be changed within the database that cannot be done though my program.
Here's my code for the "add new" and "save" buttons (and "next" & "previous"):
Code:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Try
SettingsBindingSource.EndEdit()
TableAdapterManager.UpdateAll(LMDatabase)
MsgBox("Saved")
Catch ex As Exception
MsgBox("Error While Saving")
End Try
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
SettingsBindingSource.AddNew()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
SettingsBindingSource.MoveNext()
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
SettingsBindingSource.MovePrevious()
End Sub
Thanks in advance
VS 2017 - Need as much help as you can give (write it all for me!)
-
May 11th, 2020, 11:00 AM
#2
Re: Access Database Saving
Where are you storing the database file (.mdb or .accdb)? You might be seeing some kind of virtualisation. You should not store the database in the app folder. Store it in a folder in ProgramData or the user's local appdata folder.
-
May 11th, 2020, 11:16 AM
#3
Thread Starter
Lively Member
Re: Access Database Saving
 Originally Posted by paulg4ije
Where are you storing the database file (.mdb or .accdb)? You might be seeing some kind of virtualisation. You should not store the database in the app folder. Store it in a folder in ProgramData or the user's local appdata folder.
Its stored as a local copy which Visual Studio decided the location itself. And its an .accdb - is it simply because it isn't a published version?
VS 2017 - Need as much help as you can give (write it all for me!)
-
May 11th, 2020, 11:24 AM
#4
Re: Access Database Saving
In my signature, there's a link "I swear I saved my data, where'd it run off to?" ... click, read, decide if it's your case... (hint, it probably is)
-tg
-
May 11th, 2020, 11:31 AM
#5
Thread Starter
Lively Member
Re: Access Database Saving
 Originally Posted by techgnome
In my signature, there's a link "I swear I saved my data, where'd it run off to?" ... click, read, decide if it's your case... (hint, it probably is)
-tg
It's in the bin! So it is just a debug quirk.
Thanks <3
VS 2017 - Need as much help as you can give (write it all for me!)
-
May 11th, 2020, 11:40 AM
#6
Re: Access Database Saving
It's not a quirk. It's by design... so that you don't muck up your design database with test junk or accidentally send your db into a bad state.
-tg
-
May 11th, 2020, 11:43 AM
#7
Thread Starter
Lively Member
Re: Access Database Saving
 Originally Posted by techgnome
It's not a quirk. It's by design... so that you don't muck up your design database with test junk or accidentally send your db into a bad state.
-tg
Smart, it's like they know what they are doing and I don't
VS 2017 - Need as much help as you can give (write it all for me!)
-
May 11th, 2020, 12:31 PM
#8
Re: Access Database Saving
hahaha... there's a reason I have a link to that post... it comes up a lot. A. Lot.
-tg
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|