Windows搜索、SQL查询、本地/远程



我已经在Windows 2012上安装了Windows搜索服务功能。现在我正在测试该表单,它应该将查询从Windows 2008发送到Windows 2012目录。Windows 2008也安装了Windows搜索服务,无法安装/注册数据库驱动程序。

该表单只能在Windows 2012上本地正常工作但从Windows 2008到Windows 2012(远程访问目录(都不起作用,Wireshark不显示传出查询。

查询本地目录(成功(:

("SELECT System.FileName,System.ItemPathDisplay,System.DateCreated FROM SystemIndex WHERE SCOPE='file:C:/test'", SearchConnect);

查询远程目录Windows 2008>Windows 2012(未成功(

("SELECT System.FileName,System.ItemPathDisplay,System.DateCreated FROM MyServer.SystemIndex WHERE SCOPE='file:C:/test'", SearchConnect);
("SELECT System.FileName,System.ItemPathDisplay,System.DateCreated FROM SystemIndex WHERE SCOPE='file://MyServer/C:/test'", SearchConnect);

部分代码-仅选择在测试期间被修改

 {
    string connectionString = "Provider=Search.CollatorDSO.1;Extended Properties='Application=Windows'";
    OleDbConnection SearchConnect = new OleDbConnection();
    SearchConnect.ConnectionString = connectionString;
    OleDbDataAdapter SearchAdpt = new OleDbDataAdapter("SELECT System.FileName,System.ItemPathDisplay,System.DateCreated FROM SystemIndex WHERE SCOPE='file:C:/test'", SearchConnect);
    SearchAdpt.Fill(searchResults);
  }

参考

MSDN-SCOPE和DIRECTORY谓词

您要求本地服务器在本地系统上启动搜索,由另一台服务器完成。。。

使用使用您的声明

SELECT * FROM OPENQUERY(externalServer,'script') T

在您的案例中翻译为:

"SELECT * FROM OPENQUERY(MyServer, ' SELECT System.FileName, System.ItemPathDisplay, System.DateCreated FROM SystemIndex WHERE SCOPE=''file:C:/test'' ') T"

相关内容

  • 没有找到相关文章

最新更新