Linq to SQL and SQL Server Compact Error: "There was an error parsing the query."

Posted by Jeremy on Stack Overflow See other posts from Stack Overflow or by Jeremy
Published on 2010-03-08T03:32:44Z Indexed on 2010/03/08 3:36 UTC
Read the original article Hit count: 430

I created a SQL server compact database (MyDatabase.sdf), and populated it with some data. I then ran SQLMetal.exe and generated a linq to sql class (MyDatabase.mdf)

Now I'm trying to select all records from a table with a relatively straightforward select, and I get the error:

"There was an error parsing the query. [ Token line number = 3,Token line offset = 67,Token in error = MAX]"

Here is my select code:

public IEnumerable ListItems() { MyDatabase db_m = new MyDatabase("c:\mydatabase.sdf"); return this.db_m.TestTable.Select(test => new Item() { ....
} }

I've read that Linq to SQL works with Sql Compact, is there some other configuration I need to do?

© Stack Overflow or respective owner

Related posts about linq-to-sql

Related posts about sql-server-compact