I'm writing a custom file-browser in WPF that used Windows Search Service to search files from the system. I followed the syntax for file search that is written here and here. But when I run the program an exception is raised with the following message:
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll Additional information: Unspecified error: -2147219688(0x80040718)
Here's the code that I'm using for file search:
List<string> result = new List<string>();
string connectionString = "Provider=Search.CollatorDSO;Extended Properties=\"Application=Windows\"";
OleDbConnection connection = new OleDbConnection(connectionString);
string query = @"SELECT System.ItemName FROM SystemIndex " +
@"WHERE SCOPE = 'file:O:/Design/_Revit Standards/Latest/Revit 2017 - Families' AND System.ItemName LIKE 'a%'";
OleDbCommand command = new OleDbCommand(query, connection);
connection.Open();
OleDbDataReader reader = command.ExecuteReader();
while (reader.Read())
{
result.Add(reader.GetString(0));
}
connection.Close();
Would really appreciate if someone helps me with this error.