none
EntityCommandExecutionException -- How do I solve this problem? RRS feed

  • Question

  • Hello everyone..

    I need your help. I keep on getting the EntityCommandExecutionException when I run my Silverlight application. A more detailed explanation of the error says "the value passed in must be an enum base or an underlying type for an enum such as an int32".. 

    Here's the code that I use to call the imported function from my stored procedure:

    Dim resultParam As ObjectParameter = New ObjectParameter("ReturnMessage", SqlDbType.VarChar)
    context.CheckLoginStatus(resultParam, strIpAddress, strUsername, strSessionID, intCommand)

    And here are some lines from the stored procedure:

                   

                IF @Command = 1 BEGIN
       -- Delete record..
       DELETE FROM [dbo].[TBL_LOGIN] WHERE [SessionID] = @SessionID_

       SET @ReturnMsg = 'LOGOUT'
       SET @ReturnValue = 1

       -- Return the value
       RETURN @ReturnValue
        END

                

    -- Add new record...
       INSERT INTO [dbo].[TBL_LOGIN] VALUES (@IpAddress_,@SessionID_,@UserName_)
                SET @ReturnMsg = 'LOGIN'
        SET @ReturnValue = 0

    -- Return the value
        RETURN @ReturnValue

    Please help me guys.. Thanks! 

    Thursday, September 12, 2013 8:13 AM

Answers

  • Hello,

    From the exception “the value passed in must be an enum base or an underlying type for an enum such as an int32”, there may be a problem with the enum about the data type translation.

    So I suggest that we can have a try with code like beow:

    Dim resultParam As ObjectParameter = New ObjectParameter("ReturnMessage", Convert.ToInt32(SqlDbType.VarChar)).

    As the error message said, we convert it to an enum base or an underlying type.

    Suggestion above is based on what I assumed and it may be not correct for you.

    So if it is possible, could you please share your whole procedure and more code in your program?

    Thanks.

    Best Regards.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by mickey1014 Friday, September 13, 2013 7:11 AM
    Friday, September 13, 2013 6:57 AM
    Moderator

All replies

  • Hello,

    From the exception “the value passed in must be an enum base or an underlying type for an enum such as an int32”, there may be a problem with the enum about the data type translation.

    So I suggest that we can have a try with code like beow:

    Dim resultParam As ObjectParameter = New ObjectParameter("ReturnMessage", Convert.ToInt32(SqlDbType.VarChar)).

    As the error message said, we convert it to an enum base or an underlying type.

    Suggestion above is based on what I assumed and it may be not correct for you.

    So if it is possible, could you please share your whole procedure and more code in your program?

    Thanks.

    Best Regards.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by mickey1014 Friday, September 13, 2013 7:11 AM
    Friday, September 13, 2013 6:57 AM
    Moderator
  • this solves my problem~! thanks a lot.. :D
    Friday, September 13, 2013 7:12 AM