+3  A: 

I suspect it's this bit:

st.StudentID = CInt(SID)

What is SID, and is there a possibility that it's an empty string? What do you want the code to do if it is an empty string?

Jon Skeet
You are correct. SID is an empty string. I had the code in a spot that was trying to use the variable before it was set.Thank you
stratrider
+1  A: 

The only explicit conversion to integer I can see is CInt(SID) - what type is the SID field? If it contains alphanumeric values, that might be your culprit.

Traveling Tech Guy
A: 

I find LINQ to SQL's limitations intolerable, so I developed my own data foundation layer. However I have found that when I needed to use LINQ to SQL it helped to hoist all calculations out of the code.

In your case I would try:

Dim intSID = CInt(SID)
Dim maj = ...
        Where c.COTRequired = True _
        ...
        Where st.StudentID = intSID _
        ...

Note that VB.NET has the constants True and False (no quotes) that are actual boolean values.

Ray Burns