none
Datasets in multio user corporate environment! RRS feed

  • Question

  • Have been asked to look at reworking an access db I have into an ado.net version.

    Prototype is mostly great but (and sorry if I am thick on this) I have a form with navigation control and when user A changes data, user B never sees it (until they restart their app).
    This is being cached in a dataset, but how can I get it so that at each nav bar "move next" etc the user gets the actual server data and not the local dataset version.
    I can't really do clear and fill on each "next record" can I ? And if I do it that way (erm !!!) then I need to find a way of saving where I was and going to it after the clear.

    Am trying to do this in VB.net  so colleagues have a chance to be involved, and all is going well, if I can get the dataset cache turned off if it's possible.

    many thanks
    Martin


    • Edited by MartBz Monday, September 30, 2013 2:49 PM
    Monday, September 30, 2013 2:48 PM

Answers

  • Hi Martin,

    The DataReader would not work for you, as it only has read-forward capabilities and your navigation obviously has to go both forward and backwards through your data.

    How are you displaying the data? In a grid? In TextBoxes? 

    Another option is to only retrieve each record from your database as needed. Rather than displaying a full grid of data and using a navigator, you may wish to use a different form of navigation, such as a ListBox or ComboBox displaying only a bit of info (student name and id, for example). When the user chooses a student, then you retrieve that student's info from the database and display it (in TextBoxes perhaps).

    Does that give you an idea of where to go with this?

    ~~Bonnie Berent DeWitt [C# MVP]

    http://geek-goddess-bonnie.blogspot.com

    Wednesday, October 2, 2013 2:19 PM

All replies

  • Hi Martin,

    Re-retrieving data for each "next" seems a bit excessive, but if you absolutely need this functionality then you have no alternative. You can mitigate some of the headache by creating another table in your database that keeps track of the most recent updates. You can then query only that table to see if there's even been any updates (if not, then you are relieved of the task of having to retrieve everything again).

    If you *do* have to retrieve everything again, you can keep track of where you were by keeping storing the PK you were currently positioned on, and then repositioning yourself there again after you've retrieved all your data again.

    I had an ongoing discussion with another developer about something similar. His problem was getting the position of his recently inserted record, but there are enough similarities in the solution we came up with that I think you might benefit from it. You can find that discussion here: http://social.msdn.microsoft.com/Forums/en-US/09ff532f-4657-4ecb-bd20-3bc4c40ea2bc/set-binding-navigator-to-last-row-added-by-binding-sourceaddnew

    ~~Bonnie Berent DeWitt [C# MVP]

    http://geek-goddess-bonnie.blogspot.com

    Wednesday, October 2, 2013 1:33 AM
  • Hi thanks so much for the reply.

    This all seems so complex to do what Access does out of the box though?

    Maybe I am using the incorrect architecture for my app?
    I don't want to work disconnected - as I have 10 users in an academic environment who all need 100% up to date accesss to the student records on a sql server for legal reasons. Maybe I should look at datareader - or even propose staying as we are as my project does work on Access with vba - just thought I would get an easier time with code,  better looking forms and better end user experience using windows forms - but struggling - thanks again - I do appreciate your reply.


    • Edited by MartBzz Wednesday, October 2, 2013 7:43 AM
    Wednesday, October 2, 2013 7:43 AM
  • Hi Martin,

    The DataReader would not work for you, as it only has read-forward capabilities and your navigation obviously has to go both forward and backwards through your data.

    How are you displaying the data? In a grid? In TextBoxes? 

    Another option is to only retrieve each record from your database as needed. Rather than displaying a full grid of data and using a navigator, you may wish to use a different form of navigation, such as a ListBox or ComboBox displaying only a bit of info (student name and id, for example). When the user chooses a student, then you retrieve that student's info from the database and display it (in TextBoxes perhaps).

    Does that give you an idea of where to go with this?

    ~~Bonnie Berent DeWitt [C# MVP]

    http://geek-goddess-bonnie.blogspot.com

    Wednesday, October 2, 2013 2:19 PM