标签:style ar os sp for on 数据 div art
//多表多行多列的情况
foreach (DataTable dt in YourDataset.Tables) //遍历所有的datatable
{
foreach (DataRow dr in dt.Rows) ///遍历所有的行
foreach (DataColumn dc in dt.Columns) //遍历所有的列
Console.WriteLine(“{0}, {1}, {2}”, dt.TableName,
dc.ColumnName, dr[dc]); //表名,列名,单元格数据
}
//遍历一个表多行多列
foreach(DataRow mDr in dataSet.Tables[0].Rows )
{
foreach(DataColumn mDc in dataSet.Tables[0].Columns)
{
Console.WriteLine(mDr[mDc].ToString());
}
}
//遍历一个表多行一列
foreach(DataRow row in DataSet1.Tables[0].Rows)
{
Console.WriteLine(row[0].ToString());
}
//一行一列
ds.Tables[0].Rows[0]["字段"]
标签:style ar os sp for on 数据 div art
原文地址:http://www.cnblogs.com/adamge/p/4125015.html