Problem With CreateQuery<>

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Posts: 14
Joined: Fri 23 Jan 2009 18:15

Problem With CreateQuery<>

Post by daveoggy » Fri 16 Jul 2010 16:43

I don't seem to be able to use QueryCreate. I have the following code:

Code: Select all

                using (Entities ent = new Entities())
                    String sql = string.Format(@"SELECT * FROM tm_fnet");

                    var results = ent.CreateQuery(sql);

                    foreach (var row in results)
                        RTTrace.WriteLine(this.TraceName, "id " + row.ID.ToString());
This results in the error:

"The query syntax is not valid., near term '*', line 1, column 11."

This one is driving me crazy!

Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 21 Jul 2010 11:27

The CreateQuery method takes Entity SQL query, not SQL query.
Take a look at the Entity SQL article in MSDN for details.
To execute the SQL query you can use the ObjectContext.ExecuteStoreQuery method.
Please note that it is available in Entity Framework v4 only.

Post Reply