Hi folks,
from my C#-programm, I access a SQL Server 2008 Database. I have a table with a fulltextindex and want to search for an indexed entry:
SELECT page_id FROM page_categories WHERE page_title LIKE @title
When 'title' has no withespaces everything is fine, but when title does contain withespaces, the request fails. It throws no error, but the returned recordset is closed
command.ChangeParameter("title", title);
using (System.Data.IDataReader reader = command.ExecuteQuery())
{
while (reader.Read())
resultSet.Add(reader.GetInt32(0));
reader.Close();
}
I cannot enclose the @title parameter with '', because then the Command-Object would interpret the @title as a string and not a parameter.
SELECT page_id FROM page_categories WHERE page_title LIKE '@title'
Anyone knows how I can use a parameter for the LIKE request when the title-parameter can contain whitespace?
Thanks in advance, Frank