Consider this: I have a user-defined stored procedure which returns a bit value as OUTPUT. In my calling code I want to check that value. I define it in my code as follows: Dim retval As New SqlParameter() retval.ParameterName = "@return" retval.SqlDbType = SqlDbType.Bit retval.Direction = ParameterDirection.Output DataCommand.Parameters.Add(retval) DataCommand.ExecuteNonQuery() ' now check the return value If Not (CBool(retval.Value)) Then Throw New ApplicationException("SQL returned FALSE. ") End If Which appears to get the desired results, in that my code hits the If statement and continues. However, if I change the If statement to `If Not (CBool(retval.SqlValue)) ...` I get an exception …

Member Avatar
Member Avatar
+0 forum 4

The End.