0
string flexParameterSQLType = RepositoryContainer.GBM.Flex.Admin_FlexTriggerTypeParameters
   .First(x => x.RecordID == dtoFlexTriggerEventParameter.FlexTriggerTypeParameter_RecordID).SqlType;

if (flexParameterSQLType != null)
{

    if ((flexParameterSQLType == "datetime" || flexParameterSQLType == "date") && dtoFlexTriggerEventParameter.Value != null && dtoFlexTriggerEventParameter.Value != "")
        dbFlexTriggerEventParameter.Value = Convert.ToDateTime(dtoFlexTriggerEventParameter.Value).ToString("yyyyMMdd");
    else
        dbFlexTriggerEventParameter.Value = Convert.ToString(dtoFlexTriggerEventParameter.Value);
}
Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
  • 1
    "Sequence contains no elements" is pretty self-explanatory. If you don't know which sequence is causing the problem, hover your mouse over all of those terms (RepositoryContainer, GBM, etc.) and see which one is empty. Or, break up your terms into separate variables, and check each one individually. – Robert Harvey Feb 28 '21 at 16:19
  • It could also simply be that the filter you're providing to your `First` call is filtering out all of the records. – Robert Harvey Feb 28 '21 at 16:20
  • By the way `Convert.ToDateTime(...).ToString()` is horrible if you are dealing with proper SQL parameters, what are you converting it back to `string` for – Charlieface Feb 28 '21 at 16:20

0 Answers0