日期:2014-05-18 浏览次数:20422 次
OleDbDataAdapter da = new OleDbDataAdapter("select top 5 * from info where pic=1 and nclassid=26 order by id desc", conn); DataSet ds = new DataSet(); da.Fill(ds); DataTable dt = ds.Table[0].DefultView; for (int i = 0; i < dt.Rows.Count; i++) { strpics += dt.Rows[i]["DefaultPic"]; if (i < 4) { strpics += "|"; } strlinks += "show.aspx?id=" + dt.Rows[i]["id"] + "&nid=" + dt.Rows[i]["nclassid"]; } conn.Close();
------解决方案--------------------
OleDbDataAdapter da = new OleDbDataAdapter("select top 5 * from info where pic=1 and nclassid=26 order by id desc", conn); DataSet ds = new DataSet(); da.Fill(ds); DataTable dt = ds.Table[0].DefultView; for (int i = 0; i < dt.Rows.Count; i++) { strpics += dt.Rows[i]["DefaultPic"]; if (i < 4) { strpics += "|"; } strlinks += "show.aspx?id=" + dt.Rows[i]["id"] + "&nid=" + dt.Rows[i]["nclassid"]; } conn.Close();