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
Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
Category: XLinq | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 12636 | Hits: 93

Similar Posts

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