Tableadapter.update not working

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can anyone tell me why this code added automatically by C# does not work? I
can add a record on the form or modify a record, but hitting the save button
does not save changes back to the database table. I can see the chnages to
the dataset as long as the form is still loaded.

private void customerBindingNavigatorSaveItem_Click(object sender, EventArgs
e)
{
this.Validate();
this.customerBindingSource.EndEdit();

this.customerTableAdapter.Update(this.accessTest1DataSet.Customer);
 
Miha Markic,
Please excure my ignorance. How do you "set" these methods?


Miha Markic said:
Chris,

Are Insert/Update/Delete commands on adapter set?

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Chris said:
Can anyone tell me why this code added automatically by C# does not work?
I
can add a record on the form or modify a record, but hitting the save
button
does not save changes back to the database table. I can see the chnages to
the dataset as long as the form is still loaded.

private void customerBindingNavigatorSaveItem_Click(object sender,
EventArgs
e)
{
this.Validate();
this.customerBindingSource.EndEdit();

this.customerTableAdapter.Update(this.accessTest1DataSet.Customer);
 
Hi Chris,

How did you create your adapter?

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Chris said:
Miha Markic,
Please excure my ignorance. How do you "set" these methods?


Miha Markic said:
Chris,

Are Insert/Update/Delete commands on adapter set?

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Chris said:
Can anyone tell me why this code added automatically by C# does not
work?
I
can add a record on the form or modify a record, but hitting the save
button
does not save changes back to the database table. I can see the chnages
to
the dataset as long as the form is still loaded.

private void customerBindingNavigatorSaveItem_Click(object sender,
EventArgs
e)
{
this.Validate();
this.customerBindingSource.EndEdit();

this.customerTableAdapter.Update(this.accessTest1DataSet.Customer);
 
I dragged the data source over to the form and it created all the code.
Funny, I did exactly what I saw in this traning view for binding data on C#
web site. The authors example works, mine does not. The code is same. But
maybe there is a problem in the code genertaed by C# automatically. Not sure.
THis is wierd. And Itried the same thing at work and I am getting the same
result.


Miha Markic said:
Hi Chris,

How did you create your adapter?

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Chris said:
Miha Markic,
Please excure my ignorance. How do you "set" these methods?


Miha Markic said:
Chris,

Are Insert/Update/Delete commands on adapter set?

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Can anyone tell me why this code added automatically by C# does not
work?
I
can add a record on the form or modify a record, but hitting the save
button
does not save changes back to the database table. I can see the chnages
to
the dataset as long as the form is still loaded.

private void customerBindingNavigatorSaveItem_Click(object sender,
EventArgs
e)
{
this.Validate();
this.customerBindingSource.EndEdit();

this.customerTableAdapter.Update(this.accessTest1DataSet.Customer);
 
I guess you'll have to show more code..

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Chris said:
I dragged the data source over to the form and it created all the code.
Funny, I did exactly what I saw in this traning view for binding data on
C#
web site. The authors example works, mine does not. The code is same. But
maybe there is a problem in the code genertaed by C# automatically. Not
sure.
THis is wierd. And Itried the same thing at work and I am getting the same
result.


Miha Markic said:
Hi Chris,

How did you create your adapter?

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Chris said:
Miha Markic,
Please excure my ignorance. How do you "set" these methods?


:

Chris,

Are Insert/Update/Delete commands on adapter set?

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Can anyone tell me why this code added automatically by C# does not
work?
I
can add a record on the form or modify a record, but hitting the
save
button
does not save changes back to the database table. I can see the
chnages
to
the dataset as long as the form is still loaded.

private void customerBindingNavigatorSaveItem_Click(object sender,
EventArgs
e)
{
this.Validate();
this.customerBindingSource.EndEdit();

this.customerTableAdapter.Update(this.accessTest1DataSet.Customer);
 
Kerry, you are the man!
Yes, that is exactly was is happening. Thank you!!!!

Don't feel bad. Many of us have been confused by this new helpful "feature" of
VS2K5 designed to assist us in the distribution of our applications.

If possible I always leave the Database (Access, SQL Express, etc.) out of the
project until all testing is done and add it just before deployment.

Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
 
Back
Top