2

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

1
  • 4
    Please don't create your sql commands via string concatenation. That will lead to SQL Injection vulnerabilities. Use the Parameterized interface to pass any params. Nov 14, 2010 at 21:33

2 Answers 2

4

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

2
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.