我在WPF中编写自定义文件浏览器,使用here从系统中搜索文件。我遵循了here和{{3}}编写的文件搜索语法。但是当我运行该程序时,会引发异常,并显示以下消息:
未处理的类型' System.Data.OleDb.OleDbException' System.Data.dll中发生的其他信息:未指定的错误: -2147219688(0x80040718)
以下是我用于文件搜索的代码:
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();
如果有人帮助我解决此错误,我将非常感激。