Active Server Pages Programming (ASP)/calculation

Advertisement


Question
Hi Sri
I'm Mas Aida.

Here I need help on some calculation.
Let me briefly explain my problem.

I want my system to reduce (decrement) the total of book ‘A' that available in the store (in Access *.mdb).For example, currently the quantity of the book ‘A' was 3. The user will choose the book from the list by clicking the radio button to buy it.
After the user click “Buy this book!” button (in buybooks.asp), the QUANTITY(in dbase.mdb table ‘AddBooks') must reduce by -1. If the value reaches zero, the system must automatically delete the record of that particular book (eg. Book ‘A'). that means other user can't view or buy it because it is already out of stock.

The important thing is when the user click the “Buy this book!” button (buybooks.asp),
the system will automatically can keep track of the user(buyer) information (from table “Login” in dbase.mdb) such as Name, IDNo, Address, ContactNo and Email, so that the user do not need to fill up any form. The book title and the user details will store in database (table “Buyer”).

I hope you understand my explanation and my problem.
Really need your help!..
TQ.

p/s: can I have your email address so that I can attach all the files to your email?  

Answer
Hi

Looks like you need to write a sql script to update the books quantity

to reducue here is the sql script

update books set quantity = quantity - 1 where bookid = 1234

This will reduce the book quantity

when you retrieve the book use the following script

select * from books where quantity > 0

then the user won't see any books if the quantity is 0..

hope this helps

Happy Programming!

-srini

Active Server Pages Programming (ASP)

All Answers


Answers by Expert:


Ask Experts

Volunteer


Srini Nagarajan

Expertise

I can answer any kind of questions in ASP.NET, C#, VB.NET, SharePoint 2007, ASP, Coldfusion, Powerbuilder 7.00 / 8.00, JAVA servlets, MS SQL 2000 / MSSQL7, Sybase

Experience

Contact me if you need any custom development on ASP.NET, ASP, SharePoint 2007, Coldfusion, Powerbuilder.

©2012 About.com, a part of The New York Times Company. All rights reserved.