no database linked Dataset seems to lose values
Posted on 2004-08-15
I have a strongly typed non-database connected local dataset called "priceStream1". I am iterating through a grid which adds rows to the "Instrument" table within this dataset (see below).
At the end of this loop, for debug reasons, I am displaying the table data in XML of the records added - in my instance this is two and all is fine so far.
However, when I then try to inspect the dataset from another procedure within the same page (in my example I am assigning this new messageBox function which should display the data again to a simple server side button) the record count of the dataset is zero and therefore the XML statement is empty (apart from the default stuff).
It looks like some sort of scope issue but the priceStream1 dataset should be visible throughout my class.
Any help would greatly be appreciated.
private void Button2_Click(object sender, System.EventArgs e)
for (int i = 0; i <= WebGrid1.RootTable.Rows.Count - 1; i++)
PriceStream.InstrumentRow myRow = priceStream1.Instrument.NewInstrumentRow();
myRow.Code = WebGrid1.RootTable.Rows[i].Cells.Text;
myRow.Price = Convert.ToDouble(strPrice);
myRow.Col = 0;
myRow.Row = i;
myRow.RequestID = i;