how to partially update a row of data in a table ?

Last post 07-01-2008 6:46 AM by diananyy. 4 replies.

Sort Posts:

  • how to partially update a row of data in a table ?

    06-30-2008, 11:36 PM
    • Member
      2 point Member
    • diananyy
    • Member since 06-24-2008, 11:51 AM
    • Posts 8

    hi, i am currently making a table about number of people who register as member, login to my webpage everyday or every week. my target is make it like live (the table could refresh everyhalf a minutes to show the number of people login to my webpage.) but i dont want to refresh the whole table because only the first row of the table will change. for addition information i m using gridview to show all this info. i couldnt refresh the whole the table because of it would cause a heavy load to my server.

     

    my table is something look like this

     Date     no. of login     no of register    

    1 july      23                 10      <---- row (date today) which i wanna it refresh always to get latest data

    30 jun     30                  5      

    29 jun      17                 10

    28 jun      30                5

    .

    .

    .

     

  • Re: how to partially update a row of data in a table ?

    07-01-2008, 4:38 AM
    • Star
      7,995 point Star
    • MelvynHarbour
    • Member since 06-06-2008, 9:33 AM
    • Cambridge, UK
    • Posts 1,288

    I would think that given the sort of information you are reporting, you should have a table in your database to cache the results of the analysis. Then have a stored procedure to get the data from the table. It will be able to selectively update only the first row before returning all the data. This has the additional advantage that you will not even need to keep refreshing the data each time you first go to the page, unless you explicitly decide to!

  • Re: how to partially update a row of data in a table ?

    07-01-2008, 4:43 AM
    Answer
    • All-Star
      28,218 point All-Star
    • johram
    • Member since 06-13-2006, 10:36 AM
    • Sweden
    • Posts 3,543
    • Moderator

    You still need to do a call to the database every x minute to get that one row. I don't think the overhead for getting the rest of the rows (unless they are a large number) is noteable, as compared to the complexity that you impose to your solution in trying to do this one-line update thing. I assume your intention is to place this table on an admin page, and typically you won't have a large number of users accessing this page. So, I doubt you will experience a heavy load here.

    If you plan for a heavy load, you can cache the entire dataset and then invalidate it every x minutes. This will keep the number of database calls at a minimum. But again, I doubt the heavy load is an issue here?

    If this post was useful to you, please mark it as answer. Thank you!
  • Re: how to partially update a row of data in a table ?

    07-01-2008, 5:23 AM
    Answer
    • Contributor
      2,342 point Contributor
    • Maulik Patel
    • Member since 12-21-2007, 6:48 AM
    • Ahmedabad
    • Posts 333

    hi
    I hope my suggestion will help you.

    What you have to do is ..

    Fill the grid on page load.

    Make one web service which will give you the data of today's registered user.
    Return the _ separated values as a string from web method. ex..  nooflogin_noofregister( 23_10 )

    Now call this web service through the java script.

    So, in java script you have the latest data. now you have to just find the grid row and assign the latest values to those cells.

    sample code to do this...

    function BindLatestData()
            {
                // call the web service and fetch the latest data.
                // code to call web service.
               
                // code to assign latest value to the grid.
                var table = document.getElementById("<%= GridView.ClientID %>");
                var Cell = table.rows[1].cells[1]; // your first cell containing the no of login on 1 july
                Cell.innerHTML = noofLogin;
               
                Cell = table.rows[1].cells[2];  // your second cell containing the no of register on 1 july
                Cell.innerHTML = noofRegister;
            }


    Now, call this function after some interval.
    window.setTimeout("BindLatestData()",120000) //this will fire BindLatestData() function after every 2 min.


    Hope this will help you. If you have any doubts let me know.

    Maulik Patel
    MCTS, Software Engineer

    Don't forget to click "Mark as Answer" on the post that helped you. This will give you point and help readers to know which post solved your issue and make their search easy.
  • Re: how to partially update a row of data in a table ?

    07-01-2008, 6:46 AM
    • Member
      2 point Member
    • diananyy
    • Member since 06-24-2008, 11:51 AM
    • Posts 8

    wow ... thanks a lot for the suggestion ..

Page 1 of 1 (5 items)