bAN
bAN

Reputation: 13825

SQLite.Interop.DLL How to use non managed DLL

I would like to use System.Data.SQLite with an wpf application. So I dowloaded the files here and add the reference to System.Data.SQLite downloaded.

Then I write the code

 SQLiteConnection connex = new SQLiteConnection(@"Data Source=C:\Users\Toto\Desktop\Test.sqlite;");
        connex.Open();
        DataTable dt = new DataTable();
        SQLiteCommand command = connex.CreateCommand();
        command.CommandText = "SELECT * FROM TEST";
        SQLiteDataAdapter da = new SQLiteDataAdapter();
        da.SelectCommand = command;
        da.Fill(dt);
        connex.Close();

But It doesn't work.. When I try to open the connexion, it says that it is impossible to find the SQLite.Interop.dll.. No problem I have this one but impossible to add reference to it because it is an unmanaged DLL.

So, if someone is used to use SQLite and ADO.NET I'm looking for advices..

Thanks a lot

Upvotes: 5

Views: 3528

Answers (1)

SLaks
SLaks

Reputation: 887405

You just need to copy the unmanaged DLL to the same folder as your EXE.

Upvotes: 8

Related Questions