I get the correct numbers out of the variable(in this case 11) but 开发者_开发问答I cannot compare it because I get this error:
System.InvalidCastException: The conversion is not valid
both values are int. I cannot seem to find the problem.
Dim id = CInt(Request.QueryString("id"))
Dim uk = From hj In dc.Orders _
Where hj.UserID = id _
Select hj
I'd guess that by just having Dim id
that it's getting created as an object, not an integer. Try:
Dim id as Integer
id = CInt(Request.QueryString("id"))
Actually, you should probably be using
Integer.TryParse(Request.QueryString("id"),id)
just in case someone passes in a non-int param.
精彩评论