Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 21, 2012 03:59 PM by DaveRook
Feb 21, 2012 03:39 PM|LINK
I have created an Inline table function in SSMS (called FullSearch()).
From within SSMS I can run a query like
select * from FullSearch('batman')
and the database returns results.
I'm getting an error when calling this function within Linq. I have dragged the function ont my .dbml page (using Linq to Sql) and the compiler recognises it.
My code is
public IQueryable<Models.SearchResults> GetSearchResultsByPhrase(string searchPhrase)
IQueryable<Models.SearchResults> videoSearch = (from v in this.FullSearch(searchPhrase)
select new Models.SearchResults
ShortDescription = v.shortDescription,
LongDescription = v.LongDescription,
VideoUrl = v.Url
It compiles, but I get the run time error:
System.Data.SqlClient.SqlException: The full-text query parameter for Fulltext Query String is not valid.
As mentioned, I can run a query using FullSearch within SSMS so I can only assume the fault is with my Linq query, but I'm not sure how. I am passing a one word string (batman) to the Linq query.
Any idea what I have done wrong?
Feb 21, 2012 03:43 PM|LINK
Entity Framework does not natively support FullText searches. Check this workaround:
Feb 21, 2012 03:48 PM|LINK
I'm sorry, I don't understand how mine differs from the article you've shown (although thank you for a quick repsonse).
Feb 21, 2012 03:59 PM|LINK
Actually, this is the answer
To resolve, make sure the nvarchar size is 4000 (I did this in my database and function)