p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

asp_databases thread: Re: Clicking refresh button on browser will i nsert the same reco rd again

Message #1 by "Matt Riemann" <mriemann@b...> on Mon, 3 Mar 2003 11:13:39 -0800
Have you tried clearing the buffer after you add the record.

Response.buffer =3D true
Response.redirect request("script_name")

-----Original Message-----
From: Gillian Harber [mailto:gillian@m...]
Sent: Thursday, February 27, 2003 6:17 AM
To: ASP Databases
Subject: [asp_databases] Re: Clicking refresh button on browser will i
nsert the same reco rd again

I have a suggestion.  It has sort of already been suggested, but not in
way I'm going to suggest exactly.

Have your page with your form on it.  This page gets submitted to an
entirely different page, this page collects the request.form data and
whatever your page would orginally have done.  At the end of the page
is receiving the data you have a response.redirect back to the page with
form on.  Now the important bit, make sure the page you submit to (the
collecting the data) has no html on it.  The page you sumbitted the data
will never reach the browser, hence clicking back only goes back to the
with the form on (although you will be already on this page after the
redirect from the receiving data page).  Clicking refresh will only
the page since the page does not still have the form post data.

Hope that helps.


----- Original Message -----
From: <Colin.Montgomery@C...>
To: "ASP Databases" <asp_databases@p...>
Sent: Thursday, February 27, 2003 12:15 PM
Subject: [asp_databases] Re: Clicking refresh button on browser will i
the same reco rd again

> you're absolutely right Paul - flawed logic on my part.  I am
> find out how this could be accomplished, so i'll keep thinking about
> post any ideas I have.  If you do figure it out, it would be good if
> could post your solution.
> Cheers,
> Col
> -----Original Message-----
> From: paul murphy [mailto:paulmcn01@y...]
> Sent: 26 February 2003 21:42
> To: ASP Databases
> Subject: [asp_databases] Re: Clicking refresh button on browser will i
> nsert the same record again
> thanks for replying colin,
> I'll run through anexample of your explanation just to make sure I got
> correct and then I'll show you how I'll still have problems!
> 1.I insert a record into the field and the autonumber of this field
> increment automatically when I insert the record(ie I don't have to
> this value in my INSERT statement).
> 2. I then  grab this autonumber field for the record I just entered
> the database and store it in the session variable.
> 3. The user is back to the page from where they entered the values
> previously. They then hit refresh on the browser. I go to check my
> variable and see if it corresponds to the number of the record that
> just entered. It was so the user can't enter record...
> But the user might want to enter a new record, which they can do form
> page. The session variable will prevent them from doing this aswell
> When they try to insert a new reocrd it will check then session
> against the autonumber in the database and prevent the user from
> So they will only be allowed to insert one record which I don't want!
> > how about setting the value of the session variable equal to the
> Keyfield of
> the record, once it's inserted?  I.e. if you're using an
> Autonumber/Identity
> field, simply insert the record, grab it's ID and write it to the
> variable.  THis way, before you do each insert you can check if the
> exists already and alert the user as opposed to inserting a duplicate.
> Would this work?
> HTH,
> Col
> *******
> This message and any attachment are confidential and may be privileged
otherwise protected from disclosure.  If you are not the intended
please telephone or email the sender and delete this message and any
attachment from your system.  If you are not the intended recipient you
not copy this message or attachment or disclose the contents to any
> For further information about Clifford Chance please see our website
http://www.cliffordchance.com or refer to any Clifford Chance office.

  Return to Index