locked
The given key was not present in the dictionary. Error RRS feed

  • Question

  • I want to check null value of "new_accountshort" .its a varchar field

    its giving me error "The Given key was not present in the dictionary."

     if (((DynamicEntity)BE)["new_accountshort"].ToString() != null)
    {

    }
    Monday, January 17, 2011 9:54 AM

Answers

  • Since you are using dynamicEntity, it will get only the non null values. So you can use DynamicEntity.Contains method to check for the null values.

    in your case its

    if (((DynamicEntity)BE).Properties.Contains("new_accountshort"))
    {
     //Perfrom action
    }

    • Marked as answer by Nijesh_online Monday, January 17, 2011 10:10 AM
    Monday, January 17, 2011 10:05 AM

All replies

  • Since you are using dynamicEntity, it will get only the non null values. So you can use DynamicEntity.Contains method to check for the null values.

    in your case its

    if (((DynamicEntity)BE).Properties.Contains("new_accountshort"))
    {
     //Perfrom action
    }

    • Marked as answer by Nijesh_online Monday, January 17, 2011 10:10 AM
    Monday, January 17, 2011 10:05 AM
  • Thanks Vinoth. Its working fine
    Monday, January 17, 2011 10:09 AM