﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - BatchUpdate</title><link>http://www.intersoftsolutions.com/Community/Tags/BatchUpdate/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>BatchUpdate in webgrid Issue when using SQL DataSource</title><link>http://www.intersoftsolutions.com/Community/Tags/BatchUpdate/</link><pubDate>Tue, 19 Aug 2014 09:51:06 GMT</pubDate><dc:creator>sample4170</dc:creator><category>WebGrid</category><category>BatchUpdate</category><category>sqldatasource</category><description>&lt;p&gt;Hi,&lt;/p&gt;&lt;p&gt;I am having a webgrid with SQL Datasource which allows BatchUpdate. I've written code behind using the samples given with the product.&lt;/p&gt;&lt;p&gt;Now, my issue is this: When a single row is updated, it affects the Physical DB and is reflected when refreshed, properly. But, when a set of rows are affected, in the code behind, the values are sent to the SQL Update Parameters correctly but the Physical DB is updated to have the last row change being applied to all those corresponding rows.&lt;/p&gt;&lt;p&gt;For eg., I am changing 2 rows' with column "ratio" = 76 and 85 respectively and update it. The code behind passes the value properly and the grid is showing the same. Once I press refresh, the DB shows BOTH those two rows to have "ratio" = 85.&lt;/p&gt;&lt;p&gt;My SQL update command is as usual normal: "Update table_name set ratio=@Ratio where ID=@Id";&lt;/p&gt;&lt;p&gt;SQL Update Parameters: @Ratio, @Id&lt;/p&gt;&lt;p&gt;SQL Update Parameter Values: ["Ratio"].DefaultValue = newValue;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ["Id"].DefaultValue = newValue; in switch according to column name;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10pt;"&gt;This all, I have given in OnBatchUpdate function and foreach PendingChanges; SQLDS.Update() is called for time. Is there anything wrong with this code? If it is taking the latest Default value, then the Key field should also be pointing to the latest row alone, meaning only one row is affected, right?&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10pt;"&gt;Sample:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Id&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;Ratio&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;Override&lt;/p&gt;&lt;p&gt;1&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;90&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;true&lt;/p&gt;&lt;p&gt;2&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;100&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;true&lt;/p&gt;&lt;p&gt;After Update, my Physical DB is like this:&lt;/p&gt;&lt;p&gt;1&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;100&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;true&lt;/p&gt;&lt;p&gt;2&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;100&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;true&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;foreach row&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;"Id".defaultvalue = keyValue;&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;foreach column_changed_data&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;tmp_ratio = newvalue if column = "Ratio"&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;tmp_override = newValue if column = "Override"&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;end loop;&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if override = "true"&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;"Ratio".Defaultvalue = tmp_ratio&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;"Override".DefaultValue = tmp_override&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;else&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;"Override".DefaultValue = tmp_override&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;SQL.update();&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;endloop;&lt;/p&gt;&lt;p&gt;I really appreciate the help. Thanks!&lt;/p&gt;</description></item><item><title>BatchUpdate (Deleting / Updating) and Review Problems
</title><link>http://www.intersoftsolutions.com/Community/Tags/BatchUpdate/</link><pubDate>Tue, 05 Jan 2010 08:41:45 GMT</pubDate><dc:creator>Attila</dc:creator><category>BatchUpdate</category><category>Review</category><description>Hello&lt;br /&gt;&lt;p&gt;I can Insert, Update and Delete records normally with BatchUpdate set to false... but I can't delete or update when it is set to true. It returns an alert with the message (for example):&lt;/p&gt;&lt;pre&gt;WebGrid failed to update 2 out of 2 changes due to errors. Please review and correct your changes.&lt;br /&gt;&lt;br /&gt;The following records were not updated:&lt;br /&gt;-Record '14037 06-01-2010 10:10:00&amp;lt;4206' : Unable to find the record '14037 06-01-2010 10:10:00&amp;lt;4206' in the datasource.&lt;br /&gt;-Record '14037 13-01-2010 10:10:00&amp;lt;4206' : Unable to find the record '14037 13-01-2010 10:10:00&amp;lt;4206' in the datasource.&lt;/pre&gt;
&lt;p&gt;The weird thing is the "&lt;strong&gt;&amp;lt;&lt;/strong&gt;" between date and 4206... The same error returns when trying to delete. Only Inserting records with batchupdate returns no error.&lt;br /&gt;&lt;br /&gt;&lt;span style="text-decoration: underline;"&gt;Other related issue:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I cant review changes because an alert saying "&lt;em&gt;WebGrid instance can't be found. Please make sure you launch this form from WebGrid UI&lt;/em&gt;" appears. My webgrid is inside a javascript generated WebDesktopWindow&lt;/p&gt;&lt;pre&gt;        function CreateWindow() {&lt;br /&gt;            var wnd = dm.GetWindow('testing');&lt;br /&gt;            if (wnd == null) {&lt;br /&gt;                wnd = new window.parent.WebDesktopWindow();&lt;br /&gt;                wnd.Text = 'Just for testing';&lt;br /&gt;                wnd.Name = 'testing';&lt;br /&gt;                wnd.AllowMinimize = "Yes";&lt;br /&gt;                wnd.AllowMaximize = "Yes";&lt;br /&gt;                wnd.AllowResize = "Yes";&lt;br /&gt;                wnd.ContentURL = "Testing/ShowTesting.aspx";&lt;br /&gt;                wnd.ContentMode = "UseIFrame";&lt;br /&gt;                dm.Windows.Add(wnd);&lt;br /&gt;                wnd.Show();&lt;br /&gt;                wnd.ResizeTo(800, 600);&lt;br /&gt;                wnd.MoveToCenterDesktop();&lt;br /&gt;                wnd.BringToFront();&lt;br /&gt;            }&lt;br /&gt;            else {&lt;br /&gt;                wnd.Activate();&lt;br /&gt;            }&lt;br /&gt;        }&lt;/pre&gt;
&lt;p&gt;My page is too extensive to upload as sample, I just would like an opinion on what it might be. I'll try to send a sample later. By the way... it is almost the same as &lt;a href="http://live.intersoftpt.com/cs/WebGrid/BatchUpdate_Enterprise.aspx?noframe=1&amp;amp;path=/WebGrid/New Features in v7/Smart Batch Update" target="_blank"&gt;this sample&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Oh...! About the version: I've updated using the Update Manager, but it returned an error. I've tried to update again and no error returned. Image as attachment.&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;TIA.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Edit: On FireFox it doesnt event terminate "Submitting all changes to server..."&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>