doctor cesar doctor cesar - 2 days ago 3
C# Question

Datagrid doesn't show older data

I have 2 datagrids. ultraGrid1 and ultraGrid2.

Ultragrid1 has newest values and Ultragrid2 has older Ultragrid1 values.

However, It always shows the same newest data not older one.

public void getAllTopActivityData()
{
dtTopAllTemp.Clear(); // Clear the all rows before new values

odagetTopAllTemp = new OracleDataAdapter(getTopAll, oradb);
odagetTopAllTemp.Fill(dtTopAllTemp); // get new rows

ultraGrid1.DataSource = dtTopAllTemp; // Shows new rows
ultraGrid2.DataSource = dtTopAllTempOld; // Shows older rows

dtTopAllTempOld = dtTopAllTemp; // Set Older rows to the datatable
}

Answer

Try changing this;

dtTopAllTempOld = dtTopAllTemp();

to this;

dtTopAllTempOld = dtTopAllTemp.Copy();