From dcab79939f01a49a1c1f28e6f180b486f049e8bd Mon Sep 17 00:00:00 2001 From: tpxxn <351765204@qq.com> Date: Mon, 27 Apr 2020 17:55:05 +0800 Subject: [PATCH] SQLite dll --- MisakaTranslator-WPF/App.config | 21 +++++++++- .../MisakaTranslator-WPF.csproj | 29 +++++++++++++ MisakaTranslator-WPF/packages.config | 5 +++ MisakaTranslator/SQLiteHelper.cs | 42 +++++++++---------- 4 files changed, 75 insertions(+), 22 deletions(-) diff --git a/MisakaTranslator-WPF/App.config b/MisakaTranslator-WPF/App.config index 39f3fa33..7ae74201 100644 --- a/MisakaTranslator-WPF/App.config +++ b/MisakaTranslator-WPF/App.config @@ -1,5 +1,9 @@  + + +
+ @@ -20,4 +24,19 @@ - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MisakaTranslator-WPF/MisakaTranslator-WPF.csproj b/MisakaTranslator-WPF/MisakaTranslator-WPF.csproj index eb1f5580..1db8698e 100644 --- a/MisakaTranslator-WPF/MisakaTranslator-WPF.csproj +++ b/MisakaTranslator-WPF/MisakaTranslator-WPF.csproj @@ -1,5 +1,6 @@  + Debug @@ -14,6 +15,8 @@ 4 true + + AnyCPU @@ -50,6 +53,12 @@ ..\packages\Config.Net.Json.4.14.23\lib\netstandard2.0\Config.Net.Json.dll + + ..\packages\EntityFramework.6.3.0\lib\net45\EntityFramework.dll + + + ..\packages\EntityFramework.6.3.0\lib\net45\EntityFramework.SqlServer.dll + ..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll @@ -66,12 +75,22 @@ ..\packages\System.Buffers.4.5.0\lib\netstandard2.0\System.Buffers.dll + ..\packages\System.Configuration.ConfigurationManager.4.7.0\lib\net461\System.Configuration.ConfigurationManager.dll + + ..\packages\System.Data.SQLite.Core.1.0.112.0\lib\net46\System.Data.SQLite.dll + + + ..\packages\System.Data.SQLite.EF6.1.0.112.0\lib\net46\System.Data.SQLite.EF6.dll + + + ..\packages\System.Data.SQLite.Linq.1.0.112.0\lib\net46\System.Data.SQLite.Linq.dll + ..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll @@ -404,4 +423,14 @@ + + + + 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 + + + + + + \ No newline at end of file diff --git a/MisakaTranslator-WPF/packages.config b/MisakaTranslator-WPF/packages.config index 59208e09..4aa883ff 100644 --- a/MisakaTranslator-WPF/packages.config +++ b/MisakaTranslator-WPF/packages.config @@ -3,12 +3,17 @@ + + + + + diff --git a/MisakaTranslator/SQLiteHelper.cs b/MisakaTranslator/SQLiteHelper.cs index dac4983d..7bd49991 100644 --- a/MisakaTranslator/SQLiteHelper.cs +++ b/MisakaTranslator/SQLiteHelper.cs @@ -66,34 +66,34 @@ public int ExecuteSql(string sql) /// /// /// 结果应包含的列数 - /// - public List ExecuteReader_OneLine(string sql,int columns) - { - SQLiteCommand cmd = new SQLiteCommand(sql, m_dbConnection); - try - { - m_dbConnection.Open(); - SQLiteDataReader myReader = cmd.ExecuteReader(); - + /// + public List ExecuteReader_OneLine(string sql,int columns) + { + SQLiteCommand cmd = new SQLiteCommand(sql, m_dbConnection); + try + { + m_dbConnection.Open(); + SQLiteDataReader myReader = cmd.ExecuteReader(); + if (myReader.HasRows == false) { m_dbConnection.Close(); return null; - } - - List ret = new List(); + } + + List ret = new List(); while (myReader.Read()) { for (int i = 0;i < columns;i++) { ret.Add(myReader[i].ToString()); } - } - - m_dbConnection.Close(); - return ret; - } - catch (System.Data.SQLite.SQLiteException e) - { - m_dbConnection.Close(); - throw new Exception(e.Message); + } + + m_dbConnection.Close(); + return ret; + } + catch (System.Data.SQLite.SQLiteException e) + { + m_dbConnection.Close(); + throw new Exception(e.Message); } }