string constr="PROVIDER=MSIDXS;DATA SOURCE=IndexData"; //调用msidxs索引服务,并指定起编录(IndexData)
OleDbConnection con=new OleDbConnection(constr);
try
{ //通过Scope来指定查找范围
strOle="SELECT Rank,FileName, Create, Access, Path FROM SCOPE('"+strWhichMethod+" \""+strDataPath+"\"') where contains('xml')";
OleDbCommand cmd=new OleDbCommand(strOle,con);
con.Open();
OleDbDataReader OleDaRead=cmd.ExecuteReader(CommandBehavior.CloseConnection);
while(OleDaRead.Read())
{
arrFileName.Add( OleDaRead["FileName"].ToString());
}
cmd.Dispose();
}
catch(Exception E)
{
Debug.Write(E.Message);
}
finally
{
con.Close();
}
OleDbConnection con=new OleDbConnection(constr);
try
{ //通过Scope来指定查找范围
strOle="SELECT Rank,FileName, Create, Access, Path FROM SCOPE('"+strWhichMethod+" \""+strDataPath+"\"') where contains('xml')";
OleDbCommand cmd=new OleDbCommand(strOle,con);
con.Open();
OleDbDataReader OleDaRead=cmd.ExecuteReader(CommandBehavior.CloseConnection);
while(OleDaRead.Read())
{
arrFileName.Add( OleDaRead["FileName"].ToString());
}
cmd.Dispose();
}
catch(Exception E)
{
Debug.Write(E.Message);
}
finally
{
con.Close();
}