使用 C#,我想访问数据表中每一行中的每个单元格。最好的做法是什么?
for (int i = 0; i <= 5; i++)
{
if (myQuantity[i]!=null && myQuantity[i].Length>0)
{
row = dt.NewRow();
row["Name"] = myName[i];
row["Quantity"] = myQuantity[i];
row["Price"] = myPrice[i];
c = Convert.ToInt32(myQuantity[i]);
int price = Convert.ToInt32(myPrice[i]) * c;
row["Amount"] = price;
dt.Rows.Add(row);
}
}