<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>FAQ - Frequently Asked Questions</title><link>http://forums.asp.net/13.aspx</link><description>Your question has probably already been answered. Look here for some great answers!</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: UPDATE/DELETE not working in Data Controls</title><link>http://forums.asp.net/thread/1905337.aspx</link><pubDate>Wed, 12 Sep 2007 16:25:08 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1905337</guid><dc:creator>LorJay</dc:creator><author>LorJay</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1905337.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=13&amp;PostID=1905337</wfw:commentRss><description>&lt;p&gt;I had the same problem, that is one mean little checkbox!&lt;/p&gt;</description></item><item><title>Re: UPDATE/DELETE not working in Data Controls</title><link>http://forums.asp.net/thread/1635979.aspx</link><pubDate>Sun, 25 Mar 2007 16:10:38 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1635979</guid><dc:creator>ashraf_gawdat</dc:creator><author>ashraf_gawdat</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1635979.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=13&amp;PostID=1635979</wfw:commentRss><description>&lt;p&gt;It seems that the solution is just setting ConflictDetection to OverwriteChanges instead of CompareAllValues. But that is not the problem in my case, because I've already set it to OverwriteChanges but still no updating happens. I've been searching for a solution for 2 days now but found nothing usefull, all the solutions I found didn't help me.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It seems that I'll throw the datagrid into the trash and do the work manually.&lt;/p&gt;</description></item><item><title>Re: UPDATE/DELETE not working in Data Controls</title><link>http://forums.asp.net/thread/1603784.aspx</link><pubDate>Sat, 03 Mar 2007 23:58:47 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1603784</guid><dc:creator>jrcrawford1010</dc:creator><author>jrcrawford1010</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1603784.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=13&amp;PostID=1603784</wfw:commentRss><description>&lt;p&gt;Thanks so much for this post&amp;nbsp; I have really been struggling to get the new ado.net and asp.net to actually work like the book says it should.&amp;nbsp; They seem to have left out this little fact. In my case in since I am dealing with a small companys database and concurancy was not going to be an issue I just unchecked Use optimmistic concurrency&amp;nbsp;and now my updates post back&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: UPDATE/DELETE not working in Data Controls</title><link>http://forums.asp.net/thread/1419625.aspx</link><pubDate>Thu, 05 Oct 2006 18:31:37 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1419625</guid><dc:creator>doank</dc:creator><author>doank</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1419625.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=13&amp;PostID=1419625</wfw:commentRss><description>&lt;p&gt;How do you apply this to a datetime type instead of a character type?&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I have this code but it will not work when the supposedly null value contains some data.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class="coloredcode"&gt;UpdateCommand=&lt;span class="st"&gt;&amp;quot;UPDATE [Admins] SET [AdminEmail] = @AdminEmail, [AdminPassword] = @AdminPassword, [AdminCreated] = @AdminCreated, [AdminLastLogin] = @AdminLastLogin, [FailedPasswordAttemptCount] = @FailedPasswordAttemptCount, [FailedPasswordAttemptWindowStart] = @FailedPasswordAttemptWindowStart, [LastPasswordChangedDate] = @LastPasswordChangedDate WHERE [AdminID] = @original_AdminID AND [AdminEmail] = @original_AdminEmail AND [AdminPassword] = @original_AdminPassword AND ISNULL([AdminCreated], &amp;#39;10/04/2006&amp;#39;) = ISNULL(@original_AdminCreated, &amp;#39;10/04/2006&amp;#39;) AND ISNULL([AdminLastLogin], &amp;#39;&amp;#39;) = ISNULL(@original_AdminLastLogin, &amp;#39;&amp;#39;) AND ISNULL([FailedPasswordAttemptCount], &amp;#39;&amp;#39;) = ISNULL(@original_FailedPasswordAttemptCount, &amp;#39;&amp;#39;) AND ISNULL([FailedPasswordAttemptWindowStart], &amp;#39;&amp;#39;) = ISNULL(@original_FailedPasswordAttemptWindowStart, &amp;#39;&amp;#39;) AND ISNULL([LastPasswordChangedDate], &amp;#39;&amp;#39;) = ISNULL(@original_LastPasswordChangedDate, &amp;#39;&amp;#39;)&amp;quot;&lt;/span&gt; OnUpdated=&lt;span class="st"&gt;&amp;quot;SqlDataSource1_Updated&amp;quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;</description></item><item><title>Re: UPDATE/DELETE not working in Data Controls</title><link>http://forums.asp.net/thread/1415705.aspx</link><pubDate>Mon, 02 Oct 2006 09:23:11 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1415705</guid><dc:creator>a4nsd</dc:creator><author>a4nsd</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1415705.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=13&amp;PostID=1415705</wfw:commentRss><description>&lt;p&gt;You can easily use UPDATE/ DELETE command by doing this:&lt;/p&gt;&lt;p&gt;&lt;font face="Courier New"&gt;UpdateCommand&lt;font color="#0000ff" size="2"&gt;=&amp;quot;UPDATE [TableNullable] SET [Col_Nullable] = @Col_Nullable, [Col_Nullable2] = @Col_Nullable2 WHERE [id] = @original_id&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;the problem is that the AND condition&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;</description></item><item><title>Re: UPDATE/DELETE not working in Data Controls</title><link>http://forums.asp.net/thread/1213351.aspx</link><pubDate>Wed, 01 Mar 2006 10:04:05 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1213351</guid><dc:creator>ninjamonk</dc:creator><author>ninjamonk</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1213351.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=13&amp;PostID=1213351</wfw:commentRss><description>&lt;p&gt;&lt;a href="http://kanthu.blogspot.com/"&gt;http://kanthu.blogspot.com/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;scroll down to objectdatasource bit, it explains it and a way around it.&lt;/p&gt;</description></item><item><title>Re: UPDATE/DELETE not working in Data Controls</title><link>http://forums.asp.net/thread/1212844.aspx</link><pubDate>Tue, 28 Feb 2006 21:38:02 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1212844</guid><dc:creator>lprigmore</dc:creator><author>lprigmore</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1212844.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=13&amp;PostID=1212844</wfw:commentRss><description>&lt;p&gt;I also have been wrestling with the same issue described in the previous post. If anyone has any insight as to its reason and solution, it would be greatly appreciated.&lt;/p&gt;
&lt;p&gt;Thanks in advance,&lt;/p&gt;
&lt;p&gt;Les&lt;/p&gt;</description></item><item><title>Re: UPDATE/DELETE not working in Data Controls</title><link>http://forums.asp.net/thread/1198642.aspx</link><pubDate>Wed, 15 Feb 2006 10:36:03 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1198642</guid><dc:creator>Gopinath</dc:creator><author>Gopinath</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1198642.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=13&amp;PostID=1198642</wfw:commentRss><description>&lt;font color=#000000&gt;
&lt;p class=MsoNormal&gt;Great! It is working prefect when using SQLDataSource even if the bound field is null, &lt;span&gt;&amp;nbsp;&lt;/span&gt;but when I use DataSet Table adaptor with ObjectDataSource, It is throwing error &lt;/p&gt;
&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal&gt;&lt;font color=#a52a2a&gt;“&lt;i&gt;ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'Update' that has parameters:&lt;/i&gt; “&lt;/font&gt; any solution for this?&lt;/p&gt;
&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal&gt;Regards&lt;/p&gt;
&lt;p class=MsoNormal&gt;Gopinathraja&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/font&gt;</description></item><item><title>UPDATE/DELETE not working in Data Controls</title><link>http://forums.asp.net/thread/1172520.aspx</link><pubDate>Wed, 18 Jan 2006 20:32:32 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1172520</guid><dc:creator>jcasp</dc:creator><author>jcasp</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1172520.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=13&amp;PostID=1172520</wfw:commentRss><description>&lt;p&gt;I've seen many posts related to UPDATE or DELETE not working when using Data Controls like GridView or FormView.&amp;nbsp; To further confuse the issue, no errors occur when this behavior kicks in, so people are left perplexed with little to go on.&lt;/p&gt;
&lt;p&gt;I suppose there could be other reasons for this behavior, but one of the reason I've recently tracked down is related to your DB Table definition.&amp;nbsp; More specifically, if you have a Column defined that is Nullable, then you may very well face this problem if your DataSource control (i.e. SqlDataSource) is defined to use ConflictDetection where all your column values are compared prior to UPDATE/DELETE operation to ensure that someone else did not make changes just before you.&lt;/p&gt;
&lt;p&gt;The reason why you UPDATE/DELETE operation may "fail" is because you can't compared Null to Null and expect a logical answer.&amp;nbsp; In many languages and in SQL, the expression (NULL = NULL) returns FALSE.&amp;nbsp; In fact, comparing any value to NULL will always return FALSE, so the auto-generated Conflict Detection enable SQL statements for UPDATE and DELETE operations will fail when involving a Nullable column (with NULL value).&lt;/p&gt;
&lt;p&gt;For example, following is a sample SQL statement generated with ConflictDetection enabled:&lt;/p&gt;&lt;font color=#ff0000 size=2&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;UpdateCommand&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&lt;font face="Courier New"&gt;="UPDATE [TableNullable] SET [Col_Nullable] = @Col_Nullable, [Col_Nullable2] = @Col_Nullable2 WHERE [id] = @original_id AND [Col_Nullable] = @original_Col_Nullable AND [Col_Nullable2] = @original_Col_Nullable2"&lt;/font&gt;&lt;/font&gt;
&lt;p&gt;Notice that each Column is simply compared (with =) to the "original" column values.&amp;nbsp; Knowing that any comparison to NULL value will result in FALSE, the above WHERE CLAUSE will fail.&amp;nbsp; To correct the problem, you can either change your columns to be Non-Nullable or change the WHERE CLAUSE of your UPDATE/DELETE SQL statements to something similar to below:&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;&lt;font color=#ff0000 size=2&gt;UpdateCommand&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="UPDATE [TableNullable] SET [Col_Nullable] = @Col_Nullable, [Col_Nullable2] = @Col_Nullable2 WHERE [id] = @original_id AND ISNULL([Col_Nullable],'') = ISNULL(@original_Col_Nullable,'') AND ISNULL([Col_Nullable2],'') = ISNULL(@original_Col_Nullable2,'')"&lt;/font&gt;&lt;/font&gt;
&lt;p&gt;You must keep in mind, however, that this example uses columns that are Character type.&amp;nbsp; You must keep in mind what your column type is when using ISNULL to translate it.&lt;/p&gt;
&lt;p&gt;Finally, it's a good programming practice to check if your SQL operation went through okay.&amp;nbsp; Problems resulting from above WILL NOT throw an error -- thus the confusion for many people.&amp;nbsp; What you must do is to handle the Updated event for your DataSource control and check for the following (Delete event should be similar):&lt;/p&gt;&lt;font size=2&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;&lt;font color=#0000ff size=2&gt;protected&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;void&lt;/font&gt;&lt;font size=2&gt; SqlDataSource1_Updated(&lt;/font&gt;&lt;font color=#0000ff size=2&gt;object&lt;/font&gt;&lt;font size=2&gt; sender, &lt;/font&gt;&lt;font color=#008080 size=2&gt;SqlDataSourceStatusEventArgs&lt;/font&gt;&lt;/font&gt;&lt;font size=2&gt;&lt;font face="Courier New"&gt; e)&lt;/font&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;e.AffectedRows; (if 0, then your operation failed)&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;e.Exception; (check for exceptions here)&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;e.ExceptionHandled; (set to True when you've handled it)&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;I hope this post was helpful to some of you that are facing this "simple" and yet elusive issue.&amp;nbsp; Happy programming.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/p&gt;&lt;/font&gt;</description></item></channel></rss>