c# 遍历DataTable

// 创建DataTable
DataTable subOrderInfo = new DataTable();
// 数据库拉取数据
subOrderInfo = bll.GetSql("select * from table where order_no = ‘" + orderNo + "");
// 记录条数
int subCount = subOrderInfo.Rows.Count;
// 遍历
for (int i = 0; i < subCount; i++)
{
    // 读取记录的下标
  subOrderInfo.Rows[i]["goods_name"];
  subOrderInfo.Rows[i]["price"];
}    

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1

c# 遍历DataTable

上一篇:Windows下本地部署Jenkins+pytest+Allure持续集成自动化环境


下一篇:windows 10激活