与SQLite并行运行的Winform

本文关键字:Winform 运行 并行 SQLite | 更新日期: 2023-09-27 18:12:14

最近我将一些winform应用程序数据移到了SQLite中。该应用程序在所有windows机器上运行良好,但在mac上的Parallels我无法打开数据库文件错误。我可以创建db文件没有任何问题。但是当我检查表是否存在时,我得到了上面的错误。

这个文件创建步骤工作正常

SQLiteConnection.CreateFile(dbFile); 

新的连接步骤失败。

SQLiteConnection dbConnection = new SQLiteConnection("Data Source=mydb.db3;Version=3;");
错误堆栈

System.Data.SQLite。无法打开数据库文件在System.Data.SQLite.SQLite3。打开(String strFilename, SQLiteConnectionFlags connectionFlags, SQLiteOpenFlagsEnum openFlags, Int32 maxPoolSize, Boolean usePool)在System.Data.SQLite.SQLiteConnection.Open ()在App.clsSQLiteDB。CheckTableExists(字符串表)

与SQLite并行运行的Winform

我设法解决了这个问题。必须在连接字符串中设置parseviafframe参数为true。

SQLiteConnection dbConnection = new SQLiteConnection("Data Source=mydb.db3;Version=3;", true);