首页 > 解决方案 > 在启用 FTS5 的已发布 VSTO 应用程序中,System.Data.SQLite 查询执行失败

问题描述

在我的 VSTO 应用程序中,我使用 sqlitefts5模块。在开发机器上,应用程序工作正常,但是当我发布它并尝试执行 SELECT 查询时 - 没有发生任何事情(甚至没有抛出异常!)!

这是我的代码:

try
{
    using (SQLiteConnection connection = new SQLiteConnection(connectionstring))
    {
        using (SQLiteDataAdapter adapter = new SQLiteDataAdapter("SELECT * FROM Categories order by Name", connection))
        {
            adapter.Fill(Globals.ThisAddIn.Categories_Table); //here is the line where the code execution goes to infinity                       
        }
    }
}
catch (SQLiteException ex) 
{
    MessageBox.Show($"{ex.Message}\nError code: {ex.ResultCode}\nHResult: {ex.HResult}\nSource: {ex.Source}\nStack trace:\n{ex.StackTrace}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (Exception ex)
{
    MessageBox.Show($"{ex.Message}\nHResult: {ex.HResult}\nSource: {ex.Source}\nStack trace:\n{ex.StackTrace}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}

无论是否安装了 NugetSystem.Data.SQLite.Core.FTS5包,它都无法在客户端机器上运行。

我使用“任何 CPU”配置和System.Data.SQLitenuget 包。开发和客户端计算机都使用 Office 64 位。

是否有任何解决方案可以使FTS5模块在客户端机器上工作?

标签: c#sqlitevstopublishfts5

解决方案


推荐阅读