none
Is there a way to reNumber data rows? RRS feed

  • Question

  • C# - VS2005 - Winforms - SQL

    I making a graph from a history table that adds a new row once a minute.

    So once a minute I get the latest row(s) and add them to the exiting table like this:

    for (int i = 0; i < tempOPTO.Tables[0].Rows.Count; ++i)
    {
        DataRow dx = tempOPTO.Tables[0].Rows[ i ];
        OPTO.Tables[0].ImportRow(dx);
    }


    Next I need to remove the oldest row to keep the number of rows in the table the same.

    But when I delete Rows[0] and I go through the graph's loop there is no Row[0] because I just deleted it.

    for (int i = 0; i < OPTO.Tables[0].Rows.Count; ++i)
    {
        // row zero is now gone - so I get an error message
        DataRow dr = OPTO.Tables[0].Rows[ i ];
    }


    I can think of a few sloppy ways to solve this problem, but I'm hoping there is a better way.

    Thanks,

    Dennis
    Friday, December 28, 2007 12:42 AM

Answers