Data access problems


Hi all ~

just tried to build my first winforms app with data access.

Using the Datasource Configuration Wizard, I selected MDFs, browsed for a MDF and tested the connection - so far so good.

I selected one of the tables from it, clicked on it in the Datasources tab and dragged it over onto my form where it created all the necessary components for me (bindingsource, tableadapter, dataset & bindingnavigator) - still all looked really good.

I ran it and it still appeared to be all fine, I made same changes to the data using my freshly written app (deletes, inserts & edits) but they did not persist. When I re-ran my app, all my
data changes were gone.

What's up here

TIA,
Kai


Answer this question

Data access problems

  • SureshJayaraman

    Any luck solving this issue I had the same problem. The Datasets are updated fine within the application. But after closing the application, if I check the DB, it was not updated.

    I checked the "Save button" code from the bindingNavigator, the adapter.Update is there and everything appears correct. I even grabbed the number of updates from the adapter.Update and it reflected the proper number of changes. But the database still isn't updated.

    I used video 9 to make my test app so I went back and watched video 8 and there wasn't anything to help me out..

    Thanks,
    Jim

  • kcabral1

    I got it finally.. After more research it turns out the the database was copying a blank version over my Debug version every time.

    I have to choose the DB in the Solution Explorer, and then in Properties change "Copy to Output Directory" from Copy Always to Copy if Newer. Did the trick.



  • Hetal_tatvasoft

    Thanks - that works great!

    What a * not so great* idea to have such a default setting @#$@#$.

    That's something that wasn't shown in lesson 8 as far as I remember!

    Thanks again!

  • Tony Hudson

    Hi,

    Go through lesson8 from the below link, then you should be able to figure out the problem. If you still cant then let us know.
    Link: http://msdn.microsoft.com/vstudio/express/vb/learning/default.aspx

    Thank you,
    Bhanu.



  • Data access problems