Windows Develop Bookmark and Share   
 index > Windows Forms General > Update database
 

Update database

When i edit details of a field using a datagridview connected to an Access database it does not save the changes to the database, it temporarily updates the datagridview, but when i re-execute the program it runs the old application therefore also does not update the datagridview...total chaos..

I am sure I am doing the update part right but it does not work.. I have tried everything possible.. but havent got anywhere!!

Here is a sample of my update code

private void exampleNavigatorSaveItem_Click(object sender, EventArgs e)

{

this.Validate();

this.exampleBindingSource.EndEdit();

exampleTableAdapter.Update(exampleDataSet.TableName);

}

Hope someone can help

Thanks in advance!!

jiya7  Monday, April 14, 2008 8:58 PM

Hi Jiya7,

As far as I know, this problem is probably caused by the reason that “UpdateCommand�is not set in TableAdapter.

View designer of your DataSet, choose Table Adapter in the main view, then in the Properties View, set the value of UpdateCommand to �UpdateCommand)� Hope that helps.

If it does not help, please provide me more detail about your database’s table design.

If anything is unclear, please feel free to let me know.

Best wishes,

Jun Wang

Jun Wang Tim  Monday, April 21, 2008 4:10 AM

Hi Jiya7,

As far as I know, this problem is probably caused by the reason that “UpdateCommand�is not set in TableAdapter.

View designer of your DataSet, choose Table Adapter in the main view, then in the Properties View, set the value of UpdateCommand to �UpdateCommand)� Hope that helps.

If it does not help, please provide me more detail about your database’s table design.

If anything is unclear, please feel free to let me know.

Best wishes,

Jun Wang

Jun Wang Tim  Monday, April 21, 2008 4:10 AM

Hey

thaks for your reply. I did get it working. It was nothing to do with my update method. I just had to delete the binding navigator which included the save button and redo the method again. It was quite weird. One second it doesn'twork the next day it works!!

Thanks a lot though!

jiya7  Monday, April 21, 2008 5:50 PM

Hi Jiya7,

Thank you for your reply.

I'm glad that your problem has been resolved.

Best wishes,

Jun Wang

Jun Wang Tim  Tuesday, April 22, 2008 12:57 AM

You can use google to search for other answers

Custom Search

More Threads

• if statement (test statement)
• Need help on FontDialog
• Windows forms user authentication
• Message Pumping
• Launching a wizard form...
• Panel Opacity
• key-value for ContextMenu
• Killing Threads
• Where Is Select Event of ToolStripMenuItem
• problem opening a new Form