From 4f48e1dbaaf2cb3167b36020c1d16d688b5e75af Mon Sep 17 00:00:00 2001 From: "DESKTOP-M4V1LH5\\Jin" Date: Wed, 20 May 2020 19:04:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dmssql=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E6=97=B6=E5=80=99=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- COMCMS.Web/Controllers/HomeController.cs | 5 +++++ COMCMS.Web/appsettings.json | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/COMCMS.Web/Controllers/HomeController.cs b/COMCMS.Web/Controllers/HomeController.cs index ce112d1..56e98ea 100644 --- a/COMCMS.Web/Controllers/HomeController.cs +++ b/COMCMS.Web/Controllers/HomeController.cs @@ -152,6 +152,11 @@ namespace COMCMS.Web.Controllers return Json(tip); } string fullsql = System.IO.File.ReadAllText(sqlFullPath); + //如果是mssql 需要替换一下 GO不能在程序中直接执行 + if (sqltype == "mssql") + { + fullsql = fullsql.Replace("GO", ";"); + } Admin.FindAll(fullsql);//执行 diff --git a/COMCMS.Web/appsettings.json b/COMCMS.Web/appsettings.json index e9c6f2b..e98f164 100644 --- a/COMCMS.Web/appsettings.json +++ b/COMCMS.Web/appsettings.json @@ -13,12 +13,12 @@ "SignSalt": "comcms" }, "connectionStrings": { - "dbconn": { + "mssqlconnon": { "connectionString": "Server=.;Port=3306;Database=comcms;Uid=root;Pwd=root;SslMode=None;charset=utf8mb4", "providerName": "MySql.Data.MySqlClient" }, - "mssqlconnon": { - "connectionString": "server=.\\SQLEXPRESS;database=comcmscore;uid=sa;pwd=123456", + "dbconn": { + "connectionString": "server=.;database=comcmscore;uid=sa;pwd=123456", "providerName": "System.Data.SqlClient" } }