a sample: if (ds.Tables[0].Rows.Count > 0) { //Get High and Low ArrayList prices = new ArrayList(); ArrayList avolume = new ArrayList(); foreach (DataRow dr in ds.Tables[0].Rows) { prices.Add((double)dr["Close"]); avolume.Add((int)dr["Volume"]); } }
ArrayList al = new ArrayList(); 初始化了 而且count数值也可以读出(调试是2山除了二行数据)只是数据类型转换出错误不知道为什么datarow月实际从表中读出的datarow 有和差别?
if (ds.Tables[0].Rows.Count > 0)
{ //Get High and Low
ArrayList prices = new ArrayList();
ArrayList avolume = new ArrayList();
foreach (DataRow dr in ds.Tables[0].Rows)
{
prices.Add((double)dr["Close"]);
avolume.Add((int)dr["Volume"]);
}
}
初始化了
而且count数值也可以读出(调试是2山除了二行数据)只是数据类型转换出错误不知道为什么datarow月实际从表中读出的datarow 有和差别?
DataRow dr2=(DataRow)al[0];//异常,因为al[0]==null
DataRow dr2=al[0] as DataRow;//没有异常,dr2现在为null