Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   problem with datasource being updated when the page is refreshed (Gridview) (http://www.velocityreviews.com/forums/t237594-problem-with-datasource-being-updated-when-the-page-is-refreshed-gridview.html)

Mike Grace 05-05-2006 04:06 PM

problem with datasource being updated when the page is refreshed (Gridview)
 
Hi,

I have a gridview which is using a SqlDataSource to update a table.

The SqlDatasource is using a stored procedure to update the table.

If I edit a row, change a value and click update the change is successfully
applied to the SQL table.

After this, the values in the underlying table are changed by another
process

If I click the refresh button, when the page is redisplayed (after clicking
retry on the warning), the underlying table is updated with the old values
that were in the grid.

This is obviously very dangerous.

How can I stop this from happening?

Surely when the page is refreshed, it shouldn't reapply the updates.

Regards


Mike




Code Rodent 05-05-2006 04:44 PM

Re: problem with datasource being updated when the page is refreshed (Gridview)
 
Young Michael,

What I normally do for this kind of situation is add a last updated
timestamp to the database table, and use this timestamp as part of the where
clause when updating the row. Sorry I rather sidetracked your original
question!

Hope this helps

Andy


1. Force the page to expire so that it
"Mike Grace" <nospammike.grace@xxx.xxx> wrote in message
news:%23UZXn3FcGHA.4312@TK2MSFTNGP05.phx.gbl...
> Hi,
>
> I have a gridview which is using a SqlDataSource to update a table.
>
> The SqlDatasource is using a stored procedure to update the table.
>
> If I edit a row, change a value and click update the change is
> successfully
> applied to the SQL table.
>
> After this, the values in the underlying table are changed by another
> process
>
> If I click the refresh button, when the page is redisplayed (after
> clicking
> retry on the warning), the underlying table is updated with the old values
> that were in the grid.
>
> This is obviously very dangerous.
>
> How can I stop this from happening?
>
> Surely when the page is refreshed, it shouldn't reapply the updates.
>
> Regards
>
>
> Mike
>
>
>





All times are GMT. The time now is 10:50 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.