views:

214

answers:

2

Hi

I'm using Microsoft Entity model framework to access my database. I get an issue while i use this execute query command for executing Sql raw query. Let me know how could i resolve it.

svdc.CreateQuery<VideoMasterTable>(
    "select * from videomastertable WHERE FREETEXT(*, '"+keyword+"')"
    ).ToList();

Thanks in Advance,

Kanal

A: 

CreateQuery takes ESQL, not T-SQL. In EF 4 (only), you can use ExecuteStoreQuery instead.

Craig Stuntz
Hi, Thanks for your update. But i tried with Executestorequery, But i could not find the solution. Please can i know how could i use this query or a code sample.
kamal
http://blogs.msdn.com/alexj/archive/2009/11/07/tip-41-how-to-execute-t-sql-directly-against-the-database.aspx
Craig Stuntz
A: 

With CreateQuery method you are creating ObjectQuery wich will be translated to entity sql (ESQL). Entity SQL is not T-SQL. It has different syntax and uses entity operations. Entity Framework doesn't have methods for Full Text Search currently. You can create such methods or use stored procedures and call them using Entity Framework. To create your methods try this article. For using stored procedures with EF check this article.

Branislav Abadjimarinov