public ActionResult TableQuery(FormCollection collection) { RoadFlow.Platform.DBConnection dBConnection = new RoadFlow.Platform.DBConnection(); string empty = string.Empty; string empty2 = string.Empty; RoadFlow.Data.Model.DBConnection dBConnection2 = null; string empty3 = string.Empty; empty = base.Request.QueryString["tablename"]; empty2 = base.Request.QueryString["dbconnid"]; dBConnection2 = dBConnection.Get(MyExtensions.ToGuid(empty2)); if (dBConnection2 == null) { base.ViewBag.LiteralResult = "未找到数据连接"; base.ViewBag.LiteralResultCount.Text = ""; return(View()); } if (collection != null) { empty3 = base.Request.Form["sqltext"]; } else { if (MyExtensions.IsNullOrEmpty(empty)) { base.ViewBag.LiteralResult = ""; base.ViewBag.LiteralResultCount = ""; return(View()); } empty3 = dBConnection.GetDefaultQuerySql(dBConnection2, empty); } if (MyExtensions.IsNullOrEmpty(empty3)) { base.ViewBag.LiteralResult = "SQL为空!"; base.ViewBag.LiteralResultCount = ""; return(View()); } if (!dBConnection.CheckSql(empty3)) { base.ViewBag.LiteralResult = "SQL含有破坏系统表的语句,禁止执行!"; base.ViewBag.LiteralResultCount = ""; RoadFlow.Platform.Log.Add("尝试执行有破坏系统表的SQL语句", empty3, RoadFlow.Platform.Log.Types.数据连接); return(View()); } DataTable dataTable = dBConnection.GetDataTable(dBConnection2, empty3); RoadFlow.Platform.Log.Add("执行了SQL", empty3, RoadFlow.Platform.Log.Types.数据连接, MyExtensions.ToJsonString((object)dataTable)); base.ViewBag.LiteralResult = Tools.DataTableToHtml(dataTable); base.ViewBag.LiteralResultCount = "(共" + dataTable.Rows.Count + "行)"; base.ViewBag.sqltext = empty3; return(View()); }