MVC3 VB.NET application. I have the below section of code in a function. This code is supposed to only fire if the handout1 is not nothing. But for some reason it is going into the then block when the handout1 is nothing in the database… I have tried a hundred different ways of checking but it is still trying to run that line of code even when there is nothing to assign to it….
If Not _class1.Contains("---") Then
_body = _body.Replace("[[Class1]]", _class1 + " : " + _day1Class.course_title)
Dim _coursesREF As cours = db.courses.Where(Function(f) f.course_ref = class1).First
If Not String.IsNullOrWhiteSpace(_coursesREF.handoutFile1) OrElse Not IsDBNull(_coursesREF.handoutFile1) Then
_class1Handout = New Net.Mail.Attachment((Path.Combine(AppDomain.CurrentDomain.BaseDirectory) + "\CourseHandouts\") + _coursesREF.handoutFile1)
End If
Else
_body = _body.Replace("[[NL]][[Class1]]", String.Empty)
End If
Anyone see what I am obviously overlooking???
Try putting a break point in and see what Handout is equal to
also, upon further inspection, can you modify
and change it to