none
{"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;
                    PopCon.Comments.Add(comment);
                    Status = "";
                }
    
                PopCon.SaveChanges();

    Sunday, March 11, 2012 5:44 PM

Answers

  • 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

    Tuesday, March 13, 2012 2:55 AM
    Moderator