From f4a8e93de90691701b75aff9166059c9fdfae1e1 Mon Sep 17 00:00:00 2001 From: yubaolee Date: Thu, 3 Mar 2022 23:17:21 +0800 Subject: [PATCH] fix issue Sequence contains more than one element --- OpenAuth.App/Form/DragForm.cs | 2 +- OpenAuth.App/Form/LeipiForm.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenAuth.App/Form/DragForm.cs b/OpenAuth.App/Form/DragForm.cs index 9bed4bc4..76a8fa1a 100644 --- a/OpenAuth.App/Form/DragForm.cs +++ b/OpenAuth.App/Form/DragForm.cs @@ -61,7 +61,7 @@ namespace OpenAuth.App var jsonArray = JsonHelper.Instance.Deserialize(form.ContentData)["list"]; // 数据库名称 string tableName = form.DbName; - var exist = _unitWork.FromSql($"select table_name as value from information_schema.tables where table_name ='{tableName}'").SingleOrDefault(); + var exist = _unitWork.FromSql($"select distinct table_name as value from information_schema.tables where table_name ='{tableName}'").SingleOrDefault(); if (exist != null) return string.Empty; // 创建数据表 StringBuilder sql = new StringBuilder($"create table if not exists `{tableName}` ( Id varchar(50) not null primary key,"); //主键 diff --git a/OpenAuth.App/Form/LeipiForm.cs b/OpenAuth.App/Form/LeipiForm.cs index ec340d41..58c68104 100644 --- a/OpenAuth.App/Form/LeipiForm.cs +++ b/OpenAuth.App/Form/LeipiForm.cs @@ -61,7 +61,7 @@ namespace OpenAuth.App var jsonArray = JArray.Parse(form.ContentData); // 数据库名称 string tableName = form.DbName; - var exist = _unitWork.FromSql($"select table_name as value from information_schema.tables where table_name ='{tableName}'").SingleOrDefault(); + var exist = _unitWork.FromSql($"select distinct table_name as value from information_schema.tables where table_name ='{tableName}'").SingleOrDefault(); if (exist != null) return string.Empty; // 创建数据表 StringBuilder sql = new StringBuilder($"create table if not exists `{tableName}` ( Id varchar(50) not null primary key,"); //主键