From c2b70c3ab1279b00e93f027852dc682b04829288 Mon Sep 17 00:00:00 2001 From: croire <1432593898@qq.com> Date: Sat, 12 Mar 2022 12:52:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=A0Query=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E5=BC=82=E5=B8=B8=E5=AF=BC=E8=87=B4=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E9=94=81=E6=AD=BB=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Storage/Database/Download/DownloadDb.cs | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/DownKyi.Core/Storage/Database/Download/DownloadDb.cs b/DownKyi.Core/Storage/Database/Download/DownloadDb.cs index f32c9c9..b4cf645 100644 --- a/DownKyi.Core/Storage/Database/Download/DownloadDb.cs +++ b/DownKyi.Core/Storage/Database/Download/DownloadDb.cs @@ -160,11 +160,11 @@ namespace DownKyi.Core.Storage.Database.Download { Dictionary objects = new Dictionary(); - try + dbHelper.ExecuteQuery(sql, reader => { - dbHelper.ExecuteQuery(sql, reader => + while (reader.Read()) { - while (reader.Read()) + try { // 读取字节数组 byte[] array = (byte[])reader["data"]; @@ -177,18 +177,17 @@ namespace DownKyi.Core.Storage.Database.Download objects.Add((string)reader["id"], obj); } - }); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("Query()发生异常: {0}", e); - LogManager.Error($"{tableName}", e); - } + catch (Exception e) + { + Utils.Debugging.Console.PrintLine("Query()发生异常: {0}", e); + LogManager.Error($"{tableName}", e); + } + } + }); return objects; } - /// /// 如果表不存在则创建表 ///