我正在使用 sqlite fts5 创建一个虚拟表,并且出现以下错误消息: SQL Logic error no such module: FTS5. 下面是我的代码: 在 VS 2017 中使用包管理器 我已经下载了 SQLite 和 SQLite FTS5。
private static void CreateReport()
{
try
{
using (SQLiteConnection sqliteConnection = new SQLiteConnection(DataSources.LocalConnectionString()))
{
sqliteConnection.Open();
sqliteConnection.EnableExtensions(true);
string commandText = "CREATE TABLE IF NOT EXISTS JReport(JRId INTEGER PRIMARY KEY, IDId INTEGER, CaseId INTEGER, BoxName TEXT, JRText TEXT, JRFormatted TEXT)";
string commandText1 = "CREATE VIRTUAL TABLE IF NOT EXISTS DReport USING FTS5(JRId, CaseId, BoxName, CONTENT = 'JReport', CONTENT_ROWID = 'JRId')";
string commandText2 = "CREATE TRIGGER DocRepo AFTER INSERT ON JReport BEGIN INSERT INTO DReport(RowId, JRId, CaseId, BoxName) VALUES(NEW.JRId, NEW.CaseId, NEW.BoxName) END";
using (SQLiteCommand sqliteCommand = new SQLiteCommand(commandText, sqliteConnection))
{
sqliteCommand.ExecuteNonQuery();
sqliteCommand.Dispose();
}
using (SQLiteCommand sqliteCommand = new SQLiteCommand(commandText1, sqliteConnection))
{
sqliteCommand.ExecuteNonQuery();
sqliteCommand.Dispose();
}
using (SQLiteCommand sqliteCommand = new SQLiteCommand(commandText2, sqliteConnection))
{
sqliteCommand.ExecuteNonQuery();
sqliteCommand.Dispose();
}
sqliteConnection.Close();
}
}
catch (Exception ex)
{
MessageBoxEx.Show("An error has occurred while creating the Report table, the original error is: " +
ex.Message, "Report", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}