Message 1 of 4
Cant get SQLite to work with in my plugin, Revit 2024
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Everyone,
I have an updater and I want to use SQLite as my database. But everytime try to test my code, I get this error: System.DllNotFoundException: 'Unable to load DLL 'e_sqlite3': The specified module could not be found. (Exception from HRESULT: 0x8007007E)'
I can't find this DLL anywhere.
I get the error on this line: using (SQLiteConnection connection = new SQLiteConnection($"Data Source={dbPath};Version=3;"))
Here is my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using System.Data.SQLite;
namespace TestSqlite
{
public class Updater : IUpdater
{
private readonly Guid id = Guid.NewGuid();
private readonly UpdaterId updaterId;
private readonly string dbPath = @"C:\Users\GillesLagrilliere\OneDrive - Talenco BVBA\Desktop\test.db";
public Updater(AddInId addInId)
{
this.updaterId = new UpdaterId(addInId, id);
}
public void Execute(UpdaterData data)
{
TaskDialog.Show("TestSqlite", "Updater Executed");
try
{
using (SQLiteConnection connection = new SQLiteConnection($"Data Source={dbPath};Version=3;"))
{
connection.Open();
string sql = "CREATE TABLE IF NOT EXISTS Test (Id INTEGER PRIMARY KEY, Name TEXT)";
using (SQLiteCommand command = new SQLiteCommand(sql, connection))
{
command.ExecuteNonQuery();
}
sql = "INSERT INTO Test (Name) VALUES ('Revit Updater Triggered')";
using (SQLiteCommand command = new SQLiteCommand(sql, connection))
{
command.ExecuteNonQuery();
}
connection.Close();
}
}
catch (Exception)
{
throw;
}
}
Any help is welcome!
Gilles Lagrilliere