locked
Subtract session value before update RRS feed

  • Question

  • User-7389755 posted

    I am putting together a small database for recording stock movement.


    I have a table which will hold

    StockID

    StockItem

    QtyInStrock


    I want the user to enter in a textbox the number required from stock then do the subtraction before updating the QtyInStock

    What is the best approach for doing this.


    Any help would be great

    Sunday, October 3, 2010 3:14 PM

Answers

  • User-1199946673 posted

    A moderate acceptable architecture will be having atleast 3 tiers, presentation, business and dataaccess layers.
     

    Did you read the question?

    I am putting together a small database for recording stock movement.

     

    I have a table which will hold

    StockID

    StockItem

    QtyInStrock

     

     This is a very small website, and we're dealing with a starter. Talking about tiers, layers etc will be a massice overkill. Let him first start working with databound controls (gridview. detailsview) and Datasource controls, possibly with some code behind code.

     

    Here you can find a tutorial (chapter 3 is about Access Databases), and take a look at some articles:

    http://www.mikesdotnetting.com/Category/10

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, October 3, 2010 5:51 PM

All replies

  • User-685154102 posted

    Whatever the approach is, the entered value has to be passed to the serverside as it needs to update the database. Once it reaches the database you can pass it on to the db query through a stored procedure or a select query written in your model.

    template -

    update STOCK set QtyInStock = QtyInStock - (user entered value) where stockid = stockid1


    Sunday, October 3, 2010 3:48 PM
  • User-7389755 posted

    Exactly what I had in mind.  But how to I feed the session value to the SQL update statement?

    Sunday, October 3, 2010 4:02 PM
  • User-685154102 posted

    You dont need explicitly session to handle this but the user entered value can hop across tiers to the model. Doing this through session will be a bad idea. A moderate acceptable architecture will be having atleast 3 tiers, presentation, business and dataaccess layers. Any particular requirement you are trying to come in terms for doing it through session?

    Sunday, October 3, 2010 4:16 PM
  • User-1199946673 posted

    A moderate acceptable architecture will be having atleast 3 tiers, presentation, business and dataaccess layers.
     

    Did you read the question?

    I am putting together a small database for recording stock movement.

     

    I have a table which will hold

    StockID

    StockItem

    QtyInStrock

     

     This is a very small website, and we're dealing with a starter. Talking about tiers, layers etc will be a massice overkill. Let him first start working with databound controls (gridview. detailsview) and Datasource controls, possibly with some code behind code.

     

    Here you can find a tutorial (chapter 3 is about Access Databases), and take a look at some articles:

    http://www.mikesdotnetting.com/Category/10

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, October 3, 2010 5:51 PM