Ask the Expert

What is the method for updating the SQL table from a bound control?

I have a checkbox control on a Windows form. The control is bound to a SQL dataset column as a Boolean. The value from the database is displayed correctly. When the check state is changed and the dataadapter update method is called (after accept changes on dataset is called), no changes are made. When a dataadapter.fill is executed after the update, all original values are returned. No errors are generated. What is the method for updating the SQL table from a bound control? Setting the row and column data manually and the calling update also does nothing. The table only has one row of data.
You should NEVER call AcceptChanges on the dataset! It's exactly THAT method call that is telling the adapter later that there are no changes. The method is called automatically by the adapter upon successfully applying the update.

This was first published in November 2003

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: