User Profile & Activity

Ollie Meyers Member
ollie.meyers@sbcglobal.net

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.

 

Thanks again.

Hi Handy,

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.

 

All times are GMT -5. The time now is 1:16 AM.
Previous Next