C#打开SQLite文件

我想在C#中打开SQLite DB文件。

我从Visual Basic源代码重新编写此代码。

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

但我无法在C#控制台应用程序中打开本地计算机上的文件’web.db’。

你需要.NET的SQLite ADO.NET驱动程序或类似的东西。

您可以在Visual Studio中使用NuGet来安装由SQLite开发团队创建的官方System.Data.SQLite驱动程序。