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.Current Thread.CurrentC ulture.DateTime Format.ShortDat ePattern.ToStri ng());
string BritishDate;
string USDate;
if (sDate != "MM/dd/yyyy")
{
foreach (DataRow drItemPlan in dsItemDemand.Ta bles[0].Rows)
{
BritishDate = drItemPlan["exp_date"].ToString();
USDate = DateTime.Parse( BritishDate).To String("MM/dd/yyyy");
foreach (DataColumn col in dsItemDemand.Ta bles[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.
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.Current Thread.CurrentC ulture.DateTime Format.ShortDat ePattern.ToStri ng());
string BritishDate;
string USDate;
if (sDate != "MM/dd/yyyy")
{
foreach (DataRow drItemPlan in dsItemDemand.Ta bles[0].Rows)
{
BritishDate = drItemPlan["exp_date"].ToString();
USDate = DateTime.Parse( BritishDate).To String("MM/dd/yyyy");
foreach (DataColumn col in dsItemDemand.Ta bles[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.
Comment