locked
Gender RRS feed

  • Question

  • I'm trying to set Gender with a value from our database.

    Any one know how I can't do this?

    Gender = dr["Gender"].ToString();

    basic.Gender = Microsoft.Health.ItemTypes.Gender.Gender ;

    Thanks,
    Gary
    Tuesday, August 11, 2009 2:22 PM

Answers

  • Hello Gary,

    As you are trying to get the values from the database and set to the Gender, you can make it using a condition

    string gender=dr["Gender"].ToString(); // Here you are getting the gender value
    //Check whether the gender is male or female and update the value in V
    if(gender=="male")
    basic.Gender = Microsoft.Health.ItemTypes.Gender.Male;
    else
    basic.Gender = Microsoft.Health.ItemTypes.Gender.Female;

    Hope this helps or instead if you are getting an error as said by Aneesh, you can farward the error message, so that it will be helpful.

    -Mahesh
    Tuesday, August 11, 2009 4:06 PM
  • Gary,

    Data type mismatch was the cause of this error. I would strongly recommend you reading the entire series from Eric for better understanding when you develop a Health Vault application from scratch.

    Thanks,
    Anish Ravindran
    Tuesday, August 11, 2009 5:12 PM

All replies

  • Hello Gary,

    When you are getting the error what value are you trying to assign, I mean is it Gender.Male or Gender.Female or is it happening for both?

    What is the error that you are getting for this code?

    Thanks and Regards,
    Aneesh D.
    Tuesday, August 11, 2009 3:04 PM
  • Hello Gary,

    As you are trying to get the values from the database and set to the Gender, you can make it using a condition

    string gender=dr["Gender"].ToString(); // Here you are getting the gender value
    //Check whether the gender is male or female and update the value in V
    if(gender=="male")
    basic.Gender = Microsoft.Health.ItemTypes.Gender.Male;
    else
    basic.Gender = Microsoft.Health.ItemTypes.Gender.Female;

    Hope this helps or instead if you are getting an error as said by Aneesh, you can farward the error message, so that it will be helpful.

    -Mahesh
    Tuesday, August 11, 2009 4:06 PM
  • Gary,

    Data type mismatch was the cause of this error. I would strongly recommend you reading the entire series from Eric for better understanding when you develop a Health Vault application from scratch.

    Thanks,
    Anish Ravindran
    Tuesday, August 11, 2009 5:12 PM