I have a query that looks like this:
surveyCompleted = from s in surveyCompleted
where agentTickets.Contains(s.TicketID.Value) || s.UserID == new Guid(txtUserID.Text) select s;
The problem is that after this statement I can’t do anything with surveyCompleted because I get an InvalidCastException. Any ideas why this happens? All the other select statement with surveyCompleted work just fine but this one fails? Could it be from the statement “agentTickets.Contains(s.TicketID.Value)” in the where clause?
If
txtUserIDis aTextBox(name leads to think so), thennew Guid(txtUserID.Text)would throw if it’s not containing a preciseGuid-like string (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)