Link to home
Start Free TrialLog in
Avatar of atent
atent

asked on

ASP

In tag form i declare a button "AddNew" which react at post command. This button add in a database one record when the user push the button addnew. When user make refresh at the IE in database add a new record identical with before record. Where is the prblem? How can i change the value of AddNew button.
Avatar of hexagon47
hexagon47

what is the code that you have for the button and what action do you have in the <form>
send the code what u did until now
what i have understood from the question is that the record gets added to the database when the Add new button is pressed. and if the user refreshes the page it gets added again. Well i would advice that before adding you should check if that record already exists or not. if it does then dont add it and come up with a message saying that this has already been added. so the user has to fill the form again.
 
ASKER CERTIFIED SOLUTION
Avatar of Wakie
Wakie
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
atent,

The simplest solution is that

assuming that your page is being passed to itself then  

after the addnew process try to use

response.redirect "yourpagename.asp"

or if it is being passed on other page... try to redirect o other pages..

response.redirect "other.page"

HTH...

HAppy programming...

atent,

you can try this...

response.redirect Request.ServerVariables("SCRIPT_NAME")


Or another solution

is to check if the record alredy exist but instead of an error message if data exist,  you can make use of the update statement... to avoid data duplication...

HTH...

HAppy programming...
>> is to check if the record alredy exist but instead of an error message if data exist,  you can make use of the update statement... to avoid data duplication... <<

I beat you to that one :-)

Regards,
Wakie.
What is the status of this question?