LINQ Error: String must be exactly one character long.

Posted by: Pencil Bros. Geology, Inc., on 29 Oct 2007 | View original | Bookmarked: 0 time(s)

When working with some Linq today, I kept getting the following error:

String must be exactly one character long.

This one had me scratching my head for a while. Turns out the problem was in the Linq to SQL designer, and the way the code generator interpreted results from the view I was using.

To remedy this, go back to the designer, pin the Properties sidebar open, and look at the elements which have been mapped. Any one which is mapped to Char(1) should be changed to a String. This should fix your problem.

Advertisement
Category: XLinq | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 12292 | Hits: 93

Similar Posts

  • Validation - Part 3 - Server-Side more
  • XML serialization using generics more
  • Lookbehind in Regex searches more
  • Validation - Part 1 - Getting Started more
  • LINQ Tip of the week: System.String support more
  • NerdDinner.com and Two Views of ASP.NET MVC Views more
  • Filtering with string parameter that allows free user input more
  • Using Enums in List Controls more
  • Using Enums in List Controls more
  • ORM Release History : Q1 2009 SP1 (version 2009.1.405.1) more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD