Skip to main content
Inspiring
January 23, 2007
Question

ASP Update Question

  • January 23, 2007
  • 1 reply
  • 197 views
Hi

I have an ASP update page where i can update my database with values from
text fields.

In my form i have fields for listprice, price, percentage and savings.

I have set a variable called 'discount' which calculates the savings amount
by taking the 'listprice'/100* percentage'
So if i enter say, a percentage of 10 for an item that has a listprice of
£100, the amount in the 'discount variable is 10.

<% dim discount
discount = Request("listprice")/100*(Request("percentage")
%>

when i enter a percentage and submit, the database is updated, but i don't
get the correct values until i submit the form again. I guess this is
because the 'percentage' is worked out from the 'percentage' value already
in the database, hense when i submit the form again, the values are
calculated from the updated 'percentage'.

How can i get the form to re-submit the update form twice. without me having
to do it manually?

Or should i be doing this another way?

Thanks in advacne
Andy


This topic has been closed for replies.

1 reply

Inspiring
January 23, 2007
That just means that your database update is happening after you grab your
recordset. Flip-flop the code blocks and you'll be fine; that way the
database is pulling the newly-updated data instead of the old.


"Andy" <andyjhughesNOSPAMTHANKS@ntlworld.com> wrote in message
news:ep5in9$c3n$1@forums.macromedia.com...
> Hi
>
> I have an ASP update page where i can update my database with values from
> text fields.
>
> In my form i have fields for listprice, price, percentage and savings.
>
> I have set a variable called 'discount' which calculates the savings
> amount by taking the 'listprice'/100* percentage'
> So if i enter say, a percentage of 10 for an item that has a listprice of
> £100, the amount in the 'discount variable is 10.
>
> <% dim discount
> discount = Request("listprice")/100*(Request("percentage")
> %>
>
> when i enter a percentage and submit, the database is updated, but i don't
> get the correct values until i submit the form again. I guess this is
> because the 'percentage' is worked out from the 'percentage' value already
> in the database, hense when i submit the form again, the values are
> calculated from the updated 'percentage'.
>
> How can i get the form to re-submit the update form twice. without me
> having to do it manually?
>
> Or should i be doing this another way?
>
> Thanks in advacne
> Andy
>