Um.
Why are you adding the same item each time?
You create one instance of a SpectrumItem:
SpectrumItem SpectrumItem = new SpectrumItem(st, pid, bs, tresh, dwl, corl, sp,cid);
with all zero values, and then you add it repeatedly without changing it:
foreach (DataRow cdr in dt.Rows)
{
st = Convert.ToUInt32(cdr[0]);
bs = Convert.ToInt32(cdr[1]);
pid = Convert.ToInt32(cdr[2]);
cid = Convert.ToInt32(cdr[3]);
SpectList.Add(SpectrumItem);
}
I suspect that what you actually want to do is this:
foreach (DataRow cdr in dt.Rows)
{
st = Convert.ToUInt32(cdr[0]);
bs = Convert.ToInt32(cdr[1]);
pid = Convert.ToInt32(cdr[2]);
cid = Convert.ToInt32(cdr[3]);
SpectrumItem SpectrumItem = new SpectrumItem(st, pid, bs, tresh, dwl, corl, sp,cid);
SpectList.Add(SpectrumItem);
}
And remove the earlier instance completely.