Clearing the data....

  • Thread starter Thread starter Paul King
  • Start date Start date
P

Paul King

I have created a form on the web that allows us to update a table on our SQL
server using the INSERT function.

The way the page is constructed is that the results panel refreshes with the
new data after a post has been issued. This is fine and dandy, but if we
were to refresh the browser, this would duplicate another record with the
same details.

I would there like to either:

A) Clear the input from the screen after a POST has been issued or,
B) Clear the DataSet data so that this will not duplicate the information if
a refresh was issued.

Please can you help

Thanks
Paul
 
Simplest solution: After the INSERT is performed, do a Response.Redirect
back to the same page.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Kevin

Thanks for the information - the only problem is that you can Invoke the
Response.Redirect or Server.Transfer to clear the entry of the form.

However if you hit the refresh button on a blank form this will duplicate
another entry into the SQL from the DataSet. I need to somehow also clear
the DataSet.

Regards
Paul.
 
I didn't say anything about Server.Transfer. Response.Redirect tells the
browser to request a new URL. Refreshing the page redirected to does just
that: it refreshes the page that the Redirect linked to.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
No problems Kevin, I will use the Response.Redirect.

I just done a web search on Response.Redirect and it recommended to use
Server.Transfer as this was less intensive on IIS.

Regards
Paul.
 
Response.Redirect sends a Response to the Client browser, which tells it to
request another page. Yes, this does mean that the server will receive 2
requests from the client, whereas Server.Transfer transfers control to
another class without redirecting. However, there are reasons for both
methods to exist. Only Response.Redirect will ensure that a Refresh from the
browser will not cause the last PostBack to re-occur. It's not like the 2
are interchangeable. When you need to hammer nails, use a hammer, not a
screwdriver.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
I like your analogy.

I guess when ASP 2.0 is officially released this might include better, more
efficient classes??

Regards
Paul.
 
ASP 2.0 will include new features and classes. However, Response.Redirect
and Server.Transfer are not likely to be affected.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Back
Top