1

i would like to open SQLite DB file in C#.

I have this code rewrited from Visual Basic source code.

SqlConnection myConnection = new SqlConnection();
myConnection.ConnectionString = "Data Source=C:\\web.db;";
myConnection.Open();

but i can't open the file 'web.db' on local computer in C# Console Application.

2 Answers 2

3

You'll need the SQLite ADO.NET driver for .NET or something similar.

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

2 Comments

@dESource: I've updated it to a SQLite ADO.NET driver; I don't know whether it's the same one that I referred to 7 years ago though...
thanks for the prompt response. Yeah that's the same I've tried couple of time but no luck, don't understand this issue is with the binary or VS. I have the following error: 'Could not load file or assembly 'SQLitePCLRaw.core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1488e028ca7ab535'. The system cannot find the file specified.' I installed SQLitePCLRaw.core, Version=1.0.0.0 then I came across with this error:You need to call SQLitePCL.raw.SetProvider(). If you are using a bundle package, this is done by calling SQLitePCL.Batteries.Init().'. Long back it use to work fine though.
0

You can use NuGet in Visual Studio to install the offical System.Data.SQLite drivers created by the SQLite development team.

Comments

Your Answer

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.