try
{
foreach (DataRow row in tempTable.Rows)
{
row["Start_Date"] = objUtil.ConvertDate(row["Start_Date"].ToString(), "yyyyMMdd").ToString("MM/dd/yyyy hh:mm:ss").Replace("12:00:00 AM", "").Trim();
row["End_Date"] = objUtil.ConvertDate(row["End_Date"].ToString(), "yyyyMMdd").ToString("MM/dd/yyyy hh:mm:ss").Replace("12:00:00 AM", "").Trim();
row["Start_Date_DateTime"] = row["Start_Date"];
rowCnt++;
}
rowCnt = 0;
foreach (DataRow row in tempTable1.Rows)
{
row["Start_Date"] = objUtil.ConvertDate(row["Start_Date"].ToString(), "yyyyMMdd").ToString("MM/dd/yyyy hh:mm:ss").Replace("12:00:00 AM", "").Trim();
row["End_Date"] = objUtil.ConvertDate(row["End_Date"].ToString(), "yyyyMMdd").ToString("MM/dd/yyyy hh:mm:ss").Replace("12:00:00 AM", "").Trim();
row["Start_Date_DateTime"] = row["Start_Date"];
rowCnt++;
}
DataView _objdv = new DataView(tempTable);
_objdv.Sort = "Suite_ID,Start_Date_DateTime ASC";
DataTable _dt1 = _objdv.ToTable();
objSuiteRate_Table = _dt1;
DataView _objdv1 = new DataView(tempTable1);
_objdv1.Sort = "Suite_ID,Start_Date_DateTime ASC";
DataTable _dt2 = _objdv1.ToTable();
objSuiteRate_TableGLB = _dt2;
objPPCNorm.Connection.Close();
}
catch (Exception ex)
{
bool rethrow = BusinessLayerExceptionHandler.HandleException(ref ex);
throw;
}
错误信息是
无法在 DateTime 列中存储 <08-30-2011 12:00:00>。预期类型是 DateTime 对象