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
2009-11-05 20:18:29
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?
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.
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.