当前位置: 代码迷 >> ASP.NET >> 100分 :服务器是WINDOWS SERVER 2008的,在怎么使用索引服务 查询文件
  详细解决方案

100分 :服务器是WINDOWS SERVER 2008的,在怎么使用索引服务 查询文件

热度:5604   发布时间:2013-02-25 00:00:00.0
100分求助 :服务器是WINDOWS SERVER 2008的,在如何使用索引服务 查询文件
服务器是08的,http://support.microsoft.com/kb/820983介绍了如何使用索引服务编程查找文件,我就是按照上面坐的,只不过把索引服务目录的名称修改成我的ShareFiles,前端代码是:
C# code
<%@ Page Language="C#" CodeBehind="Default.aspx.cs" AutoEventWireup="false" Inherits="IndexService08._Default" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><html>   <head>      <title>WebForm3</title>      <meta name="GENERATOR"  content ="Microsoft Visual Studio 7.0">      <meta name="CODE_LANGUAGE"  content ="C#">      <meta name="vs_defaultClientScript" content="JavaScript">      <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">   </head>   <body MS_POSITIONING="GridLayout">      <form id="WebForm3" method="post" runat="server">         <asp:DataGrid id="DataGrid1"              style=" z-index : 102;  left : 326px;  position : absolute;  top : 141px; width:auto;"              runat="server"></asp:DataGrid>         <asp:Button id="Button1"              style=" z-index : 103;  left : 92px;  position : absolute;  top : 199px; right: 806px;"              runat="server" Text="Button" onclick="Button1_Click"></asp:Button>         <asp:TextBox id="TextBox1" style=" z-index : 101;  left : 90px;  position : absolute;  top : 136px" runat="server"></asp:TextBox>         <asp:Label ID="Label1" runat="server" Text=""></asp:Label>         <p>         <asp:GridView ID="GridView1" runat="server" style=" z-index : 103;  left : 92px;  position : absolute;  top : 280px; right: 806px; width:auto "              runat="server">         </asp:GridView>         </p>         <asp:TextBox ID="txtPath" runat="server"></asp:TextBox>      </form>   </body></html>


后台代码:
C# code
  using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Data;namespace IndexService08{    public partial class _Default : System.Web.UI.Page    {        protected void Page_Load(object sender, EventArgs e)        {        }        protected void Button1_Click(object sender, EventArgs e)        {            string strCatalog = "ShareFiles";//"TestCatalog";            string strQuery = "";            strQuery = "Select Filename,Size,Directory,Write,Path from Scope()  where FREETEXT('" + TextBox1.Text + "')";            string connstring = "Provider=MSIDXS.1;Integrated Security .='';Data Source=" + strCatalog;         System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(connstring);            conn.Open();            System.Data.OleDb.OleDbDataAdapter cmd = new System.Data.OleDb.OleDbDataAdapter(strQuery, conn);            System.Data.DataSet testDataSet = new System.Data.DataSet();            cmd.Fill(testDataSet, "SearchResults");            DataView source = new DataView(testDataSet.Tables[0]);            //DataGrid1.DataSource = source;            //DataGrid1.DataBind();            this.GridView1.DataSource = source;            this.GridView1.DataBind();            conn.Close();            this.Label1.Text = "共有"+testDataSet.Tables[0].Rows.Count +"条记录";        }    }}能实现索引服务,但是我想在索引目录的下一级文件夹查找,如果我的索引目录映射的文件夹是E盘中的所有文件和所有文件夹,但是我想在E盘中的某个字文件夹中索引文件,如何实现,谢谢,我觉得可能是在链接语句那个地方设置,但是不知怎么设置,请高人指点,谢谢
  相关解决方案