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; } - /// /// 如果表不存在则创建表 ///