请问各种,list<>怎样像 下面dataset 那样迭代显示数据呢? DataSet ds = bll.GetList();
if (ds.Tables[0].Rows.Count > 0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
DataRow dr = ds.Tables[0].Rows[i];
dr["Title"].ToString()
}
}用list 的话,下面操作,好像只能显示一行数据。 List<Entity.news> list = bll.LoadAll();
if (list.Count > 0)
{
foreach (Entity.news model in list)
{
model.title.tostring();
}
}
怎么写才能读出全部多行数据呢
if (ds.Tables[0].Rows.Count > 0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
DataRow dr = ds.Tables[0].Rows[i];
dr["Title"].ToString()
}
}用list 的话,下面操作,好像只能显示一行数据。 List<Entity.news> list = bll.LoadAll();
if (list.Count > 0)
{
foreach (Entity.news model in list)
{
model.title.tostring();
}
}
怎么写才能读出全部多行数据呢
解决方案 »
- 请大家帮忙看下如何在Timer1_Tick事件中触发Form1_Paint事件?
- 求助—关于VS里可视化的东西
- C#问题。懂得进,在线等。解决后在追加分
- switch case 和 level = Math.Log10(amount);有问题
- 求C#2.0/ASP.NET2.0的书籍或者资料
- 请问:如何将cad的dwg文件转换为emf/wmf文件?
- 新手提问。。。。。。。。
- 一个好的答案不容易,一个好的问题更难求,这个好问题不但益智,而且给出200分的高价,各位高手心动了吗?
- .net2003自带部署自动检测程序完整性问题
- 请教:我在用,vb7.0,C#在编辑窗体时
- 工程上传到服务器后客户端cookie无法写入
- 急救!!! SOS!!!
Response.Write("记录条数为:"+list.Count);
if (list.Count > 0)
{
foreach (Entity.news model in list)
{
Response.Write(model.title.ToString());
}
}