0

I'm learning Blazor and databases, and I'm new to programming in general.

I created a Blazor web assembly project, .NET 10 LTS with a simple local SQLite database.

I just want to use SQLite inside my project, so I got the System.Data.SQLite NuGet package, in general as a newbie it's pretty confusing which SQLite NuGet package to get cause there are so many of them.

Then I used this simple code:

string sqQuery = "SELECT * FROM";

try
{
    SQLiteConnection sqConnection = new SQLiteConnection(@"Data Source=\TalentData\test1.db");
    SQLiteCommand sqCommand = new SQLiteCommand();
}
catch(Exception exept)
{
    debugException = exept.ToString();
}

but I always get this exception:

System.DllNotFoundException: e_sqlite3 at System.Data.SQLite.SQLite3.StaticIsInitialized()

It seems like a dll of SQLite is missing, how would I fix that?

I already googled but I can't find a solution to my issue, there are so many different suggestions out there.

Also tried the package Microsoft.EntityFrameworkCore.Sqlite - I get the same error though.

0

1 Answer 1

1

The first result in a Google search for sqlite is SQLite Home Page. If one visits SQLite Home Page and clicks Download one is presented with a web page that shows various downloads. It appears that one has numerous options.

You stated that you're using .NET 10 LTS. According to An introduction to NuGet:

For .NET (including .NET Core), the Microsoft-supported mechanism for sharing code is NuGet, which defines how packages for .NET are created, hosted, and consumed, and provides the tools for each of those roles.

Going back to the SQLite Download web page if one looks under the heading Precompiled Binaries for .NET one sees

See the System.Data.SQLite.org website.

Upon navigating to System.Data.SQLite.org website one sees the following:

System.Data.SQLite is an ADO.NET provider for SQLite.

How to use this library System.Data.SQLite is available on nuget.org. Typical usage would involve adding two packages, one for System.Data.SQLite, and one containing a native build of SQLite. For example:

<ItemGroup>
    <PackageReference id="System.Data.SQLite" version="2.0.3"/>
    <PackageReference id="SourceGear.sqlite3" version="3.50.4.5"/>
</ItemGroup>

According to the documentation one should download/install two Nuget packages:

Additional Resources:

Sign up to request clarification or add additional context in comments.

Your Answer

Draft saved
Draft discarded

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.