This is very strange because as far as I can tell the method does return a value or null…I have ran it with null before and it worked…ever since I entered those 2 if statements inside the if statement, I am getting the error “not all code paths have a return value”
if (dt.Rows.Count != 0)
{
if (dt.Rows[0]["ReportID"].ToString().Length > 40)
{
string ReportID = dt.Rows[0]["ReportID"].ToString().Substring(0, 36);
string ReportIDNumtwo = dt.Rows[0]["ReportID"].ToString().Substring(36, 36);
MyGlobals1.versionDisplayTesting = ReportID;
MyGlobals1.secondversionDisplayTesting = ReportIDNumtwo;
return ReportID;
}
else if (dt.Rows[0]["ReportID"].ToString().Length < 39)
{
string ReportID = dt.Rows[0]["ReportID"].ToString();
MyGlobals1.versionDisplayTesting = ReportID;
return ReportID;
}
}
else
{
return null;
}
}
So you should do something like this: