refreshing DataTable's rows using database-data without TableAdapter.Fill method RRS feed

  • Question

  • Hi All,

    I use SQL Server 2005 and VB.net 2005. My question concerns an multi-user database app.


    I've come to a situation where I need to refresh DataTable's rows loaded previously from a databaseTable, but NOT using TableAdapter.Fill method. Knowing some rows were changed by SQL server SP, I want EXACLY rows which were loaded, not any other (ie. added in the meantime by another user). I'm not looking for simple .Fill(par1, par2, ...), because I do not want my user to go crazy while working with his/her data, and suddently see new rows comming in from database and land in dgv.


    I found nothing about that kind of "refresh", and the only solution I see for now is to:

    1. save all loaded-rows' IDs to ArrayList

    2. clear DataTable (.Fill with nothing)

    3. set ClearBeforeFill = false

    4. Fill row by row (using For each or while on ArrayL and specially designed Fill method)

    5. set ClearBeforeFill back to true


    Does anyone think of something less hammer-like ?

    Or am I missing something (I'm new to programming) ?


    No, my DataTable does not refresh automatically.

    Yes, I have checked the "refresh DataTable" in DataSet-Designer, as well as "optimistic concurrency"


    Thanks in advance

    Tuesday, June 26, 2007 6:01 PM


  • This IDs Array works for me. Finished.


    Wednesday, August 15, 2007 9:39 AM

All replies

  • Hi


    Im not sure if you can add a new field to the table maybe call it like tmp_session_id

    then store the session nr of that person currently working/adding data, and retrieve only that data back again

    then after session end record(s) is released


    if u have already have an user_id then mayb ad a table field (checkbox)  released or someting like that so like above on session end

    release records


    hope this gives you a direction on what to do



    Tuesday, June 26, 2007 6:45 PM
  • This might be useful in some way!  I'll try to think about it.


    But am affraid I do not really want to keep record physically blocked by specific user/session, putting a "flag" in databaseTable - or I missed your point (?)


    What happens if two or more users work on (partly) same rows - the flag will be overwritten and only last usr who requested these rows will have a chance to refresh, others will not.


    What I am really looking for here, is:

    1. keep loaded records in DataTable and not add any (until user decide to pick new records from DB)

    2. let user refresh records kept in DataTable (memory) - does NOT matter "who" changes these records - not adding new rec to DataTable


    I need something like TableAdapter.Update, but in opposite way.



    Tuesday, June 26, 2007 7:17 PM
  • This IDs Array works for me. Finished.


    Wednesday, August 15, 2007 9:39 AM