每个人!如果有人可以帮助我,我会非常高兴。
我开发了一个全文搜索引擎,使用 C# 和 Sql Server 2008 作为数据库。下面的查询在我在 SSMS 中运行时返回结果,但当我从 C# 代码及其参数化形式运行它时它什么也不返回:
SqlCommand cmd = new SqlCommand("SELECT distinct occurrence "+
"FROM sys.dm_fts_parser('FORMSOF(INFLECTIONAL, @doc)', 1033, 0, 0) "+
"where display_term in "+
"( "+
"SELECT display_term "+
"FROM sys.dm_fts_parser('FORMSOF(INFLECTIONAL, @searchterm)', 1033, 0, 0) "+
")",conn);
cmd.Parameters.Add("@searchterm",SqlDbType.VarChar);
cmd.Parameters["@searchterm"].Value = "distributed property";
cmd.Parameters.Add("@doc", SqlDbType.VarChar);
cmd.Parameters["@doc"].Value = "in the search of distributed ways that are provided by properties";
SqlDataReader dr = cmd.ExecuteReader();