1
我正在嘗試更新DataTable中的字段。我試圖編輯的字段是日期,我需要格式化它。在DataTable中更新行 - 爲什麼不能正常工作?
foreach (DataRow row in dt.Rows)
{
string originalRow = row["Departure Date"].ToString(); //displays "01/01/2010 12:00:00 AM"
row["Departure Date"] = DateTime.Parse(row["Departure Date"].ToString()).ToString("MM/dd/yyyy");
string newRow = row["Departure Date"].ToString(); //also displays "01/01/2010 12:00:00 AM"
}
這是怎麼沒有得到更新?
這些出發日期是否爲空? – DOK 2010-11-22 19:36:10