Dynamic Parse Exception RRS feed

  • Question

  • User-1757069096 posted


    I am creating a Dynamic Data website against SQL. 

    When editing a Table, I get the exception, System.Web.Query.Dynamic.ParseException: Operator '==' incompatible with operand types 'Char' and 'String'.

    When I checked the Table schema, it has a column with data tyoe char(1) and is a part of Composite Primary key.

    Kindly guide me how to solve this error.


    Thursday, October 2, 2008 10:49 AM

All replies

  • User-1005219520 posted

    Hi teckfreak,

    To speed up our investigation, can you create the simplest possible table that reproduces the problem. Post the T-SQL to create the table and complete instructions to reproduce the problem. EF or L2S? Leave out the Composite Primary key unless it's required to repro the problem. I'll look into it as soon as you can post instructions.

    Thursday, October 2, 2008 12:10 PM
  • User-1757069096 posted


    Here is the script for the Table

    CREATE TABLE [Test] (
     [empType] [char] (1) NOT NULL ,
     ) )

    To reproduce the problem

    1. Create a Dynamic Data website and register a LINQ to SQL class and map this Table in L2S ORM

    2. Register the L2S Data Context in Global.asax and run the Website.

    3. Click Edit in the screen for the this Table.

    Error "Operator '==' incompatible with operand types 'Char' and 'String' " will be displayed.



    Thursday, October 2, 2008 12:21 PM
  • User-1005219520 posted

    Thank's. I've reproduced the problem. I'll investigate and let you know what we find out. It might be a problem with LINQ to SQL - if so, I'll open a bug with that team.

    Thursday, October 2, 2008 2:52 PM
  • User-1005219520 posted

    Hi teckfreak,

    Many thanks for reporting this problem. 

    I've reproduced the problem and opened a bug. The only time the bug occurs is when you use char(1) as a PK with L2S - using one char as a PK would be very limiting and quite unusual. If the char(1) is not a PK the problem doesn't occur. You can't edit the PK, but you get the same exception when you select the details page. Until this bug is fixed you have a few options to work around the problem.

    1. Edit the designer.cs class and change the type from char to string.
    2. Use EF
    3. Use an Identity, GUID or other PK and have the employee Type (char1) not be the PK

    Let me know if you are able to work around this problem.


    Thursday, October 2, 2008 4:40 PM