2011-05-20 27 views
6

我想查询使用SQL的Windows搜索4.0。感兴趣的物业 是:System.Search.QueryFocusedSummaryWindows搜索SQL - 无法访问System.Search.QueryFocusedSummary

我试图从SystemIndex中读取此属性。我得到一个“列不存在”的错误信息。我可以阅读其他栏目,如:System.Search.AutoSummary

我在Windows 7操作系统和Windows Search 4.0上使用Microsoft Windows Search 3.x SDK下载 (Windows.Search.Interop.dll)。

我的查询是:
SELECT TOP 25 System.QueryFocusedSummary From SystemIndex where CONTAINS('microsoft') ORDER BY System.ItemDate DESC

我怎样才能得到查询与System.Search.QueryFocusedSummary工作?

的代码如下:

using System; 
using System.Collections; 
using System.Collections.Generic; 
using System.Data; 
using System.Data.OleDb; 
using System.IO; 
using System.Security.Permissions; 
using System.Text; 
using Microsoft.Search.Interop; 

namespace QueryFocusedSummaryTest 
{ 
    class Program 
    [Stathread] 
    static void Main(string[] args) 
    { 
     string sqlQuery = "select top 25 System.Search.QueryFocusedSummary from SystemIndex where contains('microsoft') order by System.ItemDate DESC"; 

     CSearchManager manager = new CSearchManager(); 
     ISearchCtalogManager catalogMaager = manager.GetCatalog("SystemIndex"); 
     ISearchQueryHelper queryHelper = catalogManager.GetQueryHelper(); 

     using (System.Data.OleDb.OleDbConnection conn = new OleDbConnection(queryHelper.ConnectionString)) 
     { 
      conn.Open(); 

      using (OleDbCommand command = new OleDbCommand(sqlQuery, conn)) 
      { 
       OleDbDataAdapter ds = new OleDbDataAdapter(command); 
       DataSet ds = new DataSet(); 
       ds.Fill(ds); 
       command.ExecuteNonQuery(); 
       //By now it has thrown the exception saying that the column is not found. 
      } 
     } 
    } 
} 
+1

我有同样的问题,你找到一个解决方案? – Rocklan 2012-01-10 06:06:47

回答