{"Operand type clash: uniqueidentifier is incompatible with int"} RRS feed

  • Question

  • Why this error raise

    {"Operand type clash: uniqueidentifier is incompatible with int"}

    here is my code

     if (Status == "Add")
                    DAL.Comment comment = new DAL.Comment();
                    comment.Id = Guid.NewGuid();
                    comment.AccountCallId = Guid.Parse(accountCallIdComboBox.SelectedValue.ToString());
                    comment.CommentCodeId = int.Parse(commentCodeIdComboBox.SelectedValue.ToString());
                    comment.GivenComment = givenCommentTextBox.Text;
                    Status = "";

    Sunday, March 11, 2012 5:44 PM


  • Hi Galgodage,

    Welcome to MSDN Forum.

    Please check the type of the CommentCodeId. Based on the exception message, it may caused by that CommentCodeId is defined as GUID type, but you want to convert it to int. The two types are incompatible.

    Best Regards

    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Allen_MSDN Monday, March 19, 2012 2:22 AM
    Tuesday, March 13, 2012 2:55 AM