﻿<?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 - WebGrid Enterprise - Object reference not set to an instance of an object when updating a row in WebGrid7</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Object-reference-not-set-to-an-instance-of-an-object-when-updating-a-row-in-WebGrid7/</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>Object reference not set to an instance of an object when updating a row in WebGrid7</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Object-reference-not-set-to-an-instance-of-an-object-when-updating-a-row-in-WebGrid7/</link><pubDate>Sun, 14 Mar 2010 23:50:03 GMT</pubDate><dc:creator>handy@intersoftpt.com</dc:creator><category>WebGrid7 Update Error Object Reference</category><description>&lt;p&gt;Hi Ollie,&lt;/p&gt;&lt;p&gt;Yes, somehow SqlDataSource returns incorrect parameter in when configure your database via wizard designer. I think maybe it is because you allow the changes for your ID. But changed the parameter as I suggested, has resolved the issue?&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Handy&lt;/p&gt;</description></item><item><title>Object reference not set to an instance of an object when updating a row in WebGrid7</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Object-reference-not-set-to-an-instance-of-an-object-when-updating-a-row-in-WebGrid7/</link><pubDate>Sun, 14 Mar 2010 14:51:49 GMT</pubDate><dc:creator>ollie.meyers@sbcglobal.net</dc:creator><category>WebGrid7 Update Error Object Reference</category><description>&lt;p&gt;Again, thanks for taking time to respond. It appears that declaring the Original_Id parameter in the UpdateParameters of the SQLDataSource is what is causing the Object Reference error. If I leave the statement as I originally wrote and remove the declaration, the grid works as expected. Allowing me to change key values if needed. Which is what was expected. What is confusing is that the Delete works with the Original_Id parameter declared. The @Original_Id parameter is provided by the DataSource control when you set the OldValuesParameterFormatString to "Original_{0}". This allows you access the parameter values before the change.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Thanks again.&lt;/p&gt;</description></item><item><title>Object reference not set to an instance of an object when updating a row in WebGrid7</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Object-reference-not-set-to-an-instance-of-an-object-when-updating-a-row-in-WebGrid7/</link><pubDate>Sun, 14 Mar 2010 14:08:18 GMT</pubDate><dc:creator>ollie.meyers@sbcglobal.net</dc:creator><category>WebGrid7 Update Error Object Reference</category><description>&lt;p&gt;Hi Handy,&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Thanks &lt;/p&gt;</description></item><item><title>Object reference not set to an instance of an object when updating a row in WebGrid7</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Object-reference-not-set-to-an-instance-of-an-object-when-updating-a-row-in-WebGrid7/</link><pubDate>Wed, 10 Mar 2010 03:49:26 GMT</pubDate><dc:creator>handy@intersoftpt.com</dc:creator><category>WebGrid7 Update Error Object Reference</category><description>&lt;p&gt;Hi Ollie,&lt;/p&gt;&lt;p&gt;I am still unable to run the sample. I got an exection in the line below.&lt;br /&gt;OCMGroup.Database.Global.GetConnectionString("Mission")&lt;/p&gt;
&lt;p&gt;So, I comment out all behind code and run your sample. When I update 'Minority' column, I got Object reference... error. I think this is the same error. When I view the source code, I found something that might be causing the issue. &lt;/p&gt;
&lt;p&gt;Your code:&lt;/p&gt;
&lt;p /&gt;&lt;pre&gt;UpdateCommand="UPDATE Ethnicity SET Id = @Id, Minority = @Minority, EditUser = @EditUser, EditDate = @EditDate WHERE (Id = @&lt;span style="color: rgb(255, 0, 0); "&gt;&lt;b&gt;Original_Id&lt;/b&gt;&lt;/span&gt;)"
 &amp;lt;UpdateParameters&amp;gt;
            &amp;lt;asp:Parameter Name="Id" DbType="String" Size="30" ConvertEmptyStringToNull="true" /&amp;gt;
            &amp;lt;asp:Parameter Name="Minority" DbType="Boolean" /&amp;gt;
            &amp;lt;asp:Parameter Name="EditUser" DbType="String" Size="31" ConvertEmptyStringToNull="true" /&amp;gt;
            &amp;lt;asp:Parameter Name="EditDate" DbType="DateTime" /&amp;gt;
            &amp;lt;asp:Parameter Name="&lt;span style="color: rgb(255, 0, 0); "&gt;&lt;b&gt;Original_Id&lt;/b&gt;&lt;/span&gt;" DbType="String" Size="30" ConvertEmptyStringToNull="true" /&amp;gt;
 &amp;lt;/UpdateParameters&amp;gt;&lt;/pre&gt;
&lt;p&gt; &lt;br /&gt;I think the correct parameter should return from SQL is "Id" instead of "Original_Id". Sometimes this happens in Sql because their conflict detection is not running.&lt;br /&gt;When I changed the code, I can update without face the error. &lt;/p&gt;
&lt;p&gt;My Code:&lt;/p&gt;
&lt;p /&gt;&lt;pre&gt;UpdateCommand="UPDATE Ethnicity SET Id = @Id, Minority = @Minority, EditUser = @EditUser, EditDate = @EditDate WHERE (&lt;span style="color: rgb(255, 0, 0); "&gt;&lt;b&gt;Id = @Id&lt;/b&gt;&lt;/span&gt;)"
 &amp;lt;UpdateParameters&amp;gt;
            &amp;lt;asp:Parameter Name="Minority" DbType="Boolean" /&amp;gt;
            &amp;lt;asp:Parameter Name="EditUser" DbType="String" Size="31" ConvertEmptyStringToNull="true" /&amp;gt;
            &amp;lt;asp:Parameter Name="EditDate" DbType="DateTime" /&amp;gt;
            &amp;lt;asp:Parameter Name="&lt;b&gt;&lt;span style="color: rgb(255, 0, 0); "&gt;Id&lt;/span&gt;&lt;/b&gt;" DbType="String" Size="30" ConvertEmptyStringToNull="true" /&amp;gt;
 &amp;lt;/UpdateParameters&amp;gt;&lt;/pre&gt;
&lt;p&gt;Please let me know if this works on you or not&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Handy&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p /&gt;</description></item><item><title>Object reference not set to an instance of an object when updating a row in WebGrid7</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Object-reference-not-set-to-an-instance-of-an-object-when-updating-a-row-in-WebGrid7/</link><pubDate>Mon, 08 Mar 2010 21:19:51 GMT</pubDate><dc:creator>ollie.meyers@sbcglobal.net</dc:creator><category>WebGrid7 Update Error Object Reference</category><description>&lt;p&gt;Hi Handy,&lt;/p&gt;
&lt;p&gt;Thanks for taking the time to reply to my question. I've attached the DLL to this post. As far as the Id column, it is a primary key on the table. It is identified as the key field in the WebGrid (or should be). As far changing the value of the Id field, while rare, this event does happen and that is why the Original_Id is used in the WHERE clause to let the the SqlDataSource know what value to use when is using the UPDATE statement. The database uses cascading updates and deletes so that an issue isn't opened with the IT department everytime our clients want to change the foreign key because of a typing error or business requirements. Also, I took the update to the Id column out of the statement and received the same error. Believe me, I've looked at this until I'm crossed eyed and cannot see why this is failing.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description></item><item><title>Object reference not set to an instance of an object when updating a row in WebGrid7</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Object-reference-not-set-to-an-instance-of-an-object-when-updating-a-row-in-WebGrid7/</link><pubDate>Mon, 08 Mar 2010 01:52:12 GMT</pubDate><dc:creator>handy@intersoftpt.com</dc:creator><category>WebGrid7 Update Error Object Reference</category><description>&lt;p&gt;Hi,&lt;/p&gt;&lt;p&gt;I am unable to run your sample because I am missing your class of object such as "OCMGroup".&lt;br /&gt;As far I checked, it seems the issue happened because your ID is not unique and allowed null values. The ID should not be able to change or null. Please remove it from your Update query.&lt;br /&gt;&lt;br /&gt;For testing, please try to modify only ID in your sample and refresh the grid. &lt;br /&gt;You will find that it is not updated. That's why if you update the other cell, it will return an error because unable to find the correct id. &lt;br /&gt;ID which set as PrimaryKey should be unique, cannot be changed and doesn't accept null.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Handy&lt;/p&gt;</description></item><item><title>Object reference not set to an instance of an object when updating a row in WebGrid7</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Object-reference-not-set-to-an-instance-of-an-object-when-updating-a-row-in-WebGrid7/</link><pubDate>Fri, 05 Mar 2010 14:16:45 GMT</pubDate><dc:creator>ollie.meyers@sbcglobal.net</dc:creator><category>WebGrid7 Update Error Object Reference</category><description>&lt;p&gt;I've seen other posts in the forum about this issue, but don't see a clear solution to the problem. I've attached the web page and the SQL statement to create the table. I am using a SQLDataSource connection to connect to my database server. I'm able to Insert, Update and Delete records on the grid, but I can not, for the life of me, update a record in this very simple table. I've modified the UPDATE statement in the UpdateCommand, I've disabled the server side events... every thing and still I cannot perform a  simple update statement. &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Please help I've spent way to much time for such a simple problem.&lt;img id="" style="border-right: medium none; border-top: medium none; border-left: medium none; border-bottom: medium none" src="http://www.intersoftpt.com/WebResources/Images/Community/Editor/smiley11.gif" /&gt; &lt;/p&gt;</description></item></channel></rss>