HighTechTalks DotNet Forums  

Data not saved

Dotnet Data Tools microsoft.public.dotnet.datatools


Discuss Data not saved in the Dotnet Data Tools forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Xavier
 
Posts: n/a

Default Data not saved - 08-05-2006 , 02:32 PM






Hi!

I beg your help with is issue, please, I have spent lots of time and
still do not know what I am doing wrong!

I try to show a list of countries and let the user edit/add items to
the list.

Do accomplish that, I have a Winform with a DataGridView and a
BindingNavigator. I also have the DataSet, the BindingSource and the
TableAdapter.

So far, I can see the countries that I have in the database but when I
try to edit/add items, they are kept in memory until I quit the app but
they are not saved in the database.

The BindingNavigator's Save button has the following statements:

Private Sub CountriesBindingNavigatorSaveItem_Click( .......)
Me.Validate()
Me.CountriesBindingSource.EndEdit()
Me.CountriesTableAdapter.Update(Me.CIADDataSet.Cou ntries)
End Sub

I am sure that I am missing one step, but do not know how to tell the
app to store the in-memory data in the dabase. This should be probably
done when the user closes the form, should'nt it?

Any help will be very appeciated!

Thanks
Xavier


Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: Data not saved - 08-09-2006 , 04:14 AM






Hi,

don't know if this can help but have you create a command builder
associate with yours DataAdapter ?
for example :


Dim myCommandBuilder as New OleDbCommandBuilder(CountriesTableAdapter)
....
Me.CountriesTableAdapter.Update(Me.CIADDataSet.Cou ntries)

I know that if this' not done, the update done nothing and no Exception
is return.

TSalm


Xavier a écrit :

Quote:
Hi!

I beg your help with is issue, please, I have spent lots of time and
still do not know what I am doing wrong!

I try to show a list of countries and let the user edit/add items to
the list.

Do accomplish that, I have a Winform with a DataGridView and a
BindingNavigator. I also have the DataSet, the BindingSource and the
TableAdapter.

So far, I can see the countries that I have in the database but when I
try to edit/add items, they are kept in memory until I quit the app but
they are not saved in the database.

The BindingNavigator's Save button has the following statements:

Private Sub CountriesBindingNavigatorSaveItem_Click( .......)
Me.Validate()
Me.CountriesBindingSource.EndEdit()
Me.CountriesTableAdapter.Update(Me.CIADDataSet.Cou ntries)
End Sub

I am sure that I am missing one step, but do not know how to tell the
app to store the in-memory data in the dabase. This should be probably
done when the user closes the form, should'nt it?

Any help will be very appeciated!

Thanks
Xavier


Reply With Quote
  #3  
Old   
martin
 
Posts: n/a

Default Re: Data not saved - 08-13-2006 , 03:38 PM



check the "copy to output directory" from your database file in your solution. If the "copy always" value, you will never get the added/edited registers the next time you open your app. Change this property to "copy if newer" and try again.

Sorry for my very poor english.

Martín (from argentina)
---
Posted via www.DotNetSlackers.com

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.