// 创建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