CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2011
    Posts
    5

    How to get a table automatically updated when another table is updated using C#

    Hi all, I have 4 (four) tables using MySql database, ie:

    tb_item (
    id_item, (varchar) --> PK
    item_name, (varchar)
    price, (double)
    )

    tb_order (
    id_order, (varchar) --> PK
    id_item, (varchar) -->FK
    date_order, (date)
    lead_time, (float)
    order_quantity, (double)
    )

    tb_use (
    id_use, (varchar) --> PK
    id_item, (varchar) -->FK
    date_use, (date)
    use_quantity, (double)
    )

    tb_inventory (
    id_inventory, (varchar) --> PK
    id_item, (varchar) --> FK
    id_order, (varchar) --> FK
    id_use, (varchar) --> FK
    item_stock, (double)
    )

    My problem is I want to item_stock in tb_inventory automatically updated: when tb_order.order_quantity or tb_use.use_quantity are updated, then tb_inventory.item_stock will updated automatically by using a calculation “tb_order.order_quantity – tb_use.use_quantity = tb_inventory.item_stock” (Example: 10 - 7 = 3).
    How to create code for the problem in C#.

    Please help, thanks in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How to get a table automatically updated when another table is updated using C#

    Using what DB? Access, SQL?
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Aug 2011
    Posts
    5

    Re: How to get a table automatically updated when another table is updated using C#

    Quote Originally Posted by dglienna View Post
    Using what DB? Access, SQL?
    Using MySql DB..

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured