c#中怎麼用for循環遍歷DataTable中的數據?

dt.Rows.Count   或是dt.defaultview.count,用於獲取 datatable中的數據行數


c#中怎麼用for循環遍歷DataTable中的數據?

for (int i = 0; i < dataTable.Rows.Count; i++)
{
    for (int j = 0; j < dataTable.Columns.Count; j++)
    {
        Console.WriteLine(dataTable.Rows[i][j].ToString()); 
    
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章