1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

updating data

Discussion in 'C#' started by salim, Jul 11, 2006.

  1. #1
    HI all !

    I have a stock control database, I want

    first the item sold and recorded as sold in the sale table
    secondly the item will be deleted from the stock table
    third the item wil be automatically reordered in the order table.

    is this possible please. I am using Dreamweaver/access and some of ASP that is generated, could you help me please.
    Regards.
     
    salim, Jul 11, 2006 IP
  2. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #2
    Just run three seperate queries.

    Get ItemID [SELECT]
    Insert Item with ItemID Into Sale Table [INSERT]
    Remove ItemID from Stock Table [DELETE]
    Not sure if re-ordering an entire table is in your best interest. Maybe have a Field called SortOrder as a decimal, so you can always insert items "between" other items.
     
    ccoonen, Jul 11, 2006 IP
  3. salim

    salim Peon

    Messages:
    52
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the reply, but how is it possible to do it all in one command
     
    salim, Jul 17, 2006 IP
  4. salim

    salim Peon

    Messages:
    52
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Okay, I got a gist of it, but
    cn.Execute("UPDATE tbl_Stock SET StockLevel = StockLevel - 1 WHERE ProductId = 123")
    cn.Execute("INSERT INTO tblProduct_sold (SaleId,ProductId) VALUES (321,123) ")
    do I have to insert all the productID ? in the script? you have also 321, second line, I assume it's saleID, then do I have to insert them all ?
    and again, is there any need for SQL in this case?
    I am a bit..if not new to asp, could you please elaborate more when you say about connection..ect, I would like to know where I could fit the script.
    thanks
     
    salim, Aug 1, 2006 IP