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; }
error message
couldn't store <08-30-2011 12:00:00> in datetime column.expected type datetime object
your error clear on wrong: putting string datetime column:
objutil.convertdate(row["start_date"].tostring(), "yyyymmdd").tostring("mm/dd/yyyy hh:mm:ss").replace("12:00:00 am", "").trim();
will return string. should remove formatting part or make column string type:
remove formatting part , formatting in component displays row:
objutil.convertdate(row["start_date"].tostring(), "yyyymmdd"); //**.tostring("mm/dd/yyyy hh:mm:ss").replace("12:00:00 am", "").trim()**;
or change row definition type string.
Comments
Post a Comment