i cant convert long to string inside a linq query RRS feed

  • Question

  • i try to convert a long type

    the length of the "long" is not constant

    this is the code:

    dc.table1.Where(i => friend_uid.Contains( SqlFunctions.StringConvert((double)i.User_facebook_id ))).Select(i => i.User_facebook_id).ToList();

    "friend_uid" is a string

    "User_facebook_id"  is "long" type

    and its length is not constant

    please help me

    Thursday, October 11, 2012 9:28 AM


  • Hi dania_za.

    Have you tried using .ToString() function?

    dc.table1.Where(i => friend_uid.Contains(((double)i.User_facebook_id ).ToString())).Select(i => i.User_facebook_id).ToList();

    "En los momentos de crisis, sólo la imaginación es más importante que el conocimiento"

    • Marked as answer by Alexander Sun Wednesday, October 24, 2012 9:13 AM
    Thursday, October 11, 2012 1:31 PM