Hi Chris,
Your message was brought to my attention by Frans Bouma, so here I am.
I believe you are talking about the DragDropWinApp application in Chapter
#3. If that is incorrect, please let me know.
Assuming that we are talking about the same application - I can't seem to
replicate your problem. The code sample is working absolutely fine at my
end.
When you run the application it shows one row "1, Hello World", which was
queried out of the database. When you hit "Save" without modifying any data,
since you didn't change any data, no queries get run.
Now when you modify the data to "1, Bubye World", and hit the Save button -
and then close the application, and rerun the application, you will indeed
see your changes persisted to the database.
So to the best of my knowledge, this code sample is working correctly. If
there is still any confusion please contact me directly through my blog.
- Sahil Malik [MVP]
ADO.NET 2.0 book -
http://codebetter.com/blogs/sahil.ma.../13/63199.aspx
__________________________________________________ ________
"Chris Saunders" <ev**@mountaincable.net> wrote in message
news:38***************************@MOUNTAINCABLE.N ET...
I'm just beginning to learn ADO.NET and have taken some code from
the book "Pro ADO.NET 2.0". When I run this application the "Validated"
MessageBox gets displayed but when I quit and rerun the application it
appears that the database is has not been updated.
The information displayed in the DataGrid is shown so I assume the
connection to the database is fine.
private void demoBindingNavigatorSaveItem_Click(object sender,
EventArgs e)
{
if (this.Validate())
{
System.Windows.Forms.MessageBox.Show(this,
"Validated.",
"Save",
System.Windows.Forms.MessageBoxButtons.OK,
System.Windows.Forms.MessageBoxIcon.Information);
this.demoBindingSource.EndEdit();
this.demoTableAdapter.Update(this.testDataSet.Demo );
}
else
{
System.Windows.Forms.MessageBox.Show(this,
"Validation errors
occurred.",
"Save",
System.Windows.Forms.MessageBoxButtons.OK,
System.Windows.Forms.MessageBoxIcon.Warning);
}
Any help appreciated.
Regards
Chris Saunders