SQLexpress newbie question

  • Thread starter Thread starter jed
  • Start date Start date
J

jed

I had developed a data app in C#express.When i add records to the
database in shows on the screen that it has been added but when i
close the app all the records are lost.I created the database in
VisualStudio using SQLexpress.I am beginner please help
 
Some code would be nice, but the obvious question is, are you updating your
DataSet and not writing the changes back to the database?

DataSets are disconnected by default, so assuming you are working this way,
making a change to the DataSet will not have any effect on the database
unless you accept the changes - i.e. write them back.

This might help:

http://msdn2.microsoft.com/en-us/library/system.data.dataset(VS.80).aspx

More specifically, this might help:

http://msdn2.microsoft.com/en-us/library/system.data.dataset.acceptchanges(VS.80).aspx


HTH


Peter
 
private void itemsBindingNavigatorSaveItem_Click_1(object sender,
EventArgs e)
{
this.Validate();
this.itemsBindingSource.EndEdit();

this.itemsTableAdapter.Update(this.database1DataSet.Items);

}
This is code taken from the save button on the navigator bar which was
generated by C#2005.But it does not save it back to the database.How
do i connect the dataset to the data base?
 
There's some obscure setting in regards to using a SQLServer Express
database that makes it copy over a new copy from the original location and
use it every time you run the application. Maybe you're having this
problem.

Robin S.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top