Question Loosing data info when closing APP!

malka

New member
Joined
May 31, 2010
Messages
3
Programming Experience
1-3
Hey guys!!! First i want to apologize for my bad english!! :(

Im getting crazy with this!! I made an application that works with SQL database. Lets treat is a simple record. But there's a really big problem, and i cant solve it!!!

While im using the program, i can register and use the stored data without problem. But IF i close the program, everything that i've recorded there, gets lost! It just disappear and then i have to record everything again there!!

How can i fix that, i have to show the App today for some ppls, and this bug makes my app invalid!! Please Help!!
 
It's not a bug. It's normal behaviour for a local database while developing. Once you deploy your app it will be fine. Follow the first link in my signature to get an understanding of the behaviour and how to modify it.
 
It's not a bug. It's normal behaviour for a local database while developing. Once you deploy your app it will be fine. Follow the first link in my signature to get an understanding of the behaviour and how to modify it.

Oh yeap, i've chose the "Copy to project Folder" option. But when i compiled and published the app it still not saving into my database!!

Anyway, i showed up the app yesterday, everybody loved it, specially because of the interface and its functions. But the program stills with this bug, and i really want to solve it to improve my knowledge and ofc, know how to solve that if it happens again!

Well, another idea about what could be happening to my app and why it still not saving the data? : D

Thanks for reply!! =]
 
What EXACTLY did you set the database's Copy To Output Directory property to? By default it is Copy Always, which means that your database gets overwritten every time you build the app, which is every time you run it in the debugger. You should change it to Copy If Newer. If you still have issues then you can change it to Never Copy.
 
If you do that and still have issues then it's time to make sure that you actually have code to save and that it is running and it is saving something. You should have some code that calls Update on a TableAdapter or UpdateAll on a TableAdapterManager. Find that code and put a break point on it. To do that you click the line and hit F9. Now run the app and make sure that it breaks at that line. If it doesn't then the code isn;t being executed so nothing can be saved.

If it is executed then the next step is to get the value returned by Update or UpdateAll and check its value. If it's zero then there are no changes that can be saved and if it's not zero then data is being saved.
 
jmcilhinney

Haha! OMG it's working!

I changed the option to "Always Copy", just like the first link of your signature said, and now its saving my data!

Thanks a lot for helping, really thanks! ;)
 
I changed the option to "Always Copy", just like the first link of your signature said, and now its saving my data!

It was never "not saving your data" it's just that you were copying a brand new empty database over the top of the one you just saved data in, every time you start the app
 
Back
Top