[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.6

Update changed columns in a datagrid

Asked by edwaldo1 in Programming for ASP.NET, Microsoft Visual C#.Net, WebApplications

Hi

We're struggling to find the best approach to updating only the columns that have changed in a ASP.NET 2.0 datagrid.

What we have:
The datagrid is bound to a dataset which can be very large (+40,000 rows).  All the datagrid rows are in edit mode, ie. the edit item template acts as the 'add row', the item templates all contain editable controls (textboxes, checkboxes etc), and there is a single save button for each row. In addition there is a 'save all' button.  

All the editable controls have an server-side onchanged event.  After clicking save, the onchanged event gets the index of the row and adds it to a list.  The update method then iterates this list and builds the SQL to do an update containing ALL the columns in that row.

What we need:
We need to build an SQL update statement for ONLY the columns that have changed, not the whole row.  The simple reason for this is so we can log exactly which columns have changed at the same time, rather then a log which just lists all columns.

The problem:
We can't persist the original dataset in viewstate or session and perform some comparisons (or use the columnchanged datatable event??) because it's too large.  We can't think of an elegant way to capture which columns have changed - and at the same time get the corresponding field name in the database - to dynamically build the update statement and write the log.  It's almost like I need a commandarguments property for the textbox, like a linkbutton, to store the original contents and the DB column name, then capture that on the onchanged event and build my UPDATE statement.

We could store a javascript array on the client with the old value, control ID, DB column name and row index but this seems really complex.  Surely this isn't a strange request - wanting to build an update statement with only the changed columns - are we missing something obvious?  

Many thanks.
[+][-]11/14/09 04:54 PM, ID: 25823149Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Programming for ASP.NET, Microsoft Visual C#.Net, WebApplications
Sign Up Now!
Solution Provided By: edwaldo1
Participating Experts: 3
Solution Grade: A
 
[+][-]11/04/09 07:58 AM, ID: 25740621Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/04/09 08:37 AM, ID: 25741097Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/04/09 09:33 AM, ID: 25741750Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/04/09 09:39 AM, ID: 25741801Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/04/09 10:48 AM, ID: 25742483Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/04/09 11:24 AM, ID: 25742888Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/04/09 01:57 PM, ID: 25744422Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/05/09 04:03 AM, ID: 25748582Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/05/09 06:22 AM, ID: 25749710Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/12/09 06:52 AM, ID: 25805001Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 - Hierarchy / EE_QW_3_20080625