I am getting an exception error, “Input string was not in a correct format.” “Make sure your method arguments are in the right format. When converting a string to DateTime, parse the string to take the date beforeputting each varibale into the DateTime object”.
it is pointing on the last line of this code:
cnaIntakeVSOutputDetail_Intake.Add(new IntakeVsOutput(
facility,
UnitRepository.Units(facility).SingleOrDefault(u => u.Code.Equals(reader.To("UNIT_CODE", ""))),
new Patient()
{
Account = reader.To("PATIENT_ID", ""),
MRN = reader.To("MRN", ""),
Name = reader.To("NAME_FULL", ""),
Room = reader.To("ROOM_BED", ""),
},
reader.To("INFO", ""),
Convert.ToDateTime(reader["TRDATE"]),
Convert.ToInt32(reader["MENU_ID"]),
Convert.ToInt32(reader["VALUE"]),
null, null, null));
reader["TRDATE"]does not contain a string thatConvert.ToDateTimecould convert into aDateTimevalue.This might be because it is an empty string or
DBNull.Valueornull.