Guys,
I am looping thru a dataset and need to update rows' columns based on the ColumnName value. I get this far but I'm unsure of how to update that actual columns value with the new value. Code follows:
string sDate = (Thread.CurrentThread.CurrentCulture.DateTimeForma t.ShortDatePattern.ToString());
string BritishDate;
string USDate;
if (sDate != "MM/dd/yyyy")
{
foreach (DataRow drItemPlan in dsItemDemand.Tables[0].Rows)
{
BritishDate = drItemPlan["exp_date"].ToString();
USDate = DateTime.Parse(BritishDate).ToString("MM/dd/yyyy");
foreach (DataColumn col in dsItemDemand.Tables[0].Columns)
{
if (col.ColumnName == "exp_date")
{
//UPDATE THE COLUMN VALUE TO EQUAL USDate
}
}
}
}
I'm new to C# and I'm having some issues with the fact a dataset is an object and how to then maniuplate that object's column and/or row values.
Thanks.