For the user you are trying to get have you checked that the SQL returns non NULL values and values that can be converted to the types you are converting to? I.e. run the SQL in Management Studio and check that...
<div mce_keep="true">Column UserID can be converted to Type Int and is not Null</div>
<div mce_keep="true">Colum TextMiles can be converted to type int and is not Null</div>
scott@elband...
Star
11346 Points
1865 Posts
Re: Why "Specified cast is not valid"?
Mar 19, 2008 12:10 PM|LINK
For the user you are trying to get have you checked that the SQL returns non NULL values and values that can be converted to the types you are converting to? I.e. run the SQL in Management Studio and check that...
</div>