LINQ Bug: String must be exactly one character long RRS feed

  • Question

  • The following is occurring in a WCF service I am writing to serve a Silverlight program…

    First, I know the conventional wisdom on this problem is to go into the .DBML file, find the field in the view or table and “change it from a char to a string” in the properties window.  Now in the properties window there is

    (1)    “Server Data Type” and

    (2)    “Type”


    I’m not sure which one or both to change but I have tried everything.  I changed type to system.string and that didn’t work.  I then also changed Server Data Type from VarChar(1) to Char(1) and string and none of that worked.


    I can’t change the database because it was designed by the person who owns it.


    I’m able to select one record from this table but I get the error when trying to select all records and I think that is because it is encountering a blank value in some of the records (can’t change that either).


    What happens when I set the varchar(1) to a string is that I get a different exception:

    “The formatter threw an exception while trying to deserialize the message:” with innexception:   “Content cannot be converted to the type Int. Line 1, position 886” and I get that even when selecting a single record.


    I’m 16 hours into this problem and sorry I ever decided to use LINQ but can anyone help me out here?



    .net Developer
    Monday, May 17, 2010 9:21 PM


All replies