Populating Object from Database RRS feed

  • Question

  • hi,

    I have a web based that is connected to a db and I want to make a windows application to connect to the same db, with the windows app being the master. Should I populate my Product object from the product table when I load the application at first? or should I only populate my object when I make a sale transaction?

    If I populate first, then I would have to re-sync with the db before I make a sale transaction because the web based app could've sold that ProductId that I want to sale with the Windows app.

    What is the best approach loading the entire product table into my object or loading only the productId asked for? I am working on a Point of Sale system

    Sunday, December 26, 2010 3:38 AM

All replies

  • if you have db common in the both web and window application then you have to use sql transaction to  synchronize your transaction one after another to avoid the sold product assign for sell. so you have to check for each transaction for sell item is that item is available or not.
    Sunday, December 26, 2010 7:47 AM
  • Thanks niraj oza for your reply,


    The problem is not both db will be online all the time, therefore the windows app will operate sometimes in offline mode. The one thing i am interested in knowing is:

    I know I should not link my UI directly into my db, and my object should be in the middle of the two layers...(basic OOP concept) my question is: Should I query my ENTIRE Product table and assign it to my Object in the application start up?



    Sunday, December 26, 2010 8:32 PM
  • But if you are getting data at start up you have to fetch data from server when new offline transaction will be occured so you have to store one temporary table in your db that triggers first when new transaction occured. so its easy to manage. so you can use your object to use that newly updated table........use triggers for first retrival of new data.

    following link help you.....


    Monday, December 27, 2010 6:01 PM