开发者

SQLite.Interop.DLL How to use non managed DLL

开发者 https://www.devze.com 2023-03-14 10:02 出处:网络
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.

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();
        SQLite开发者_如何学GoCommand 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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号