I have received this exception when one of my column's data table have null value. Let say I do want to allow null value or something like this, how can I fix this?
String was not recognized as a valid DateTime.
This is my code.
foreach (DataRow row in ds.Tables[0].Rows)
{
row["Effective_Period"] = Convert.ToDateTime(row["Effect_Date_From"].ToString()).ToString("dd/MM/yyyy")
+ " - " + Convert.ToDateTime(row["Effect_Date_To"].ToString()).ToString("dd/MM/yyyy");
}
In my ds.Table, here is my column
----------------------
Effective_Period
---------------------
10/2/2012 - 20/3/2012
---------------------
---------------------
---------------------