Пример #1
0
        public ActionResult Exec(ExecSqlModel model)
        {
            var res = new GridDataModel();

            try
            {
                res.Data = _service.Exec(model.Query);
            }
            catch (CoreServiceException ex)
            {
                model.Result = ex.Message;
                return(RedirectToAction("Index", model));
            }

            return(View(res));
        }
Пример #2
0
        public ActionResult Index(ExecSqlModel model)
        {
            var connStr = ConfigurationManager.ConnectionStrings["ESTORE_CONN_STR"];

            if (connStr != null)
            {
                var bld = new SqlConnectionStringBuilder(connStr.ConnectionString);

                model.Server   = bld.DataSource;
                model.DataBase = bld.InitialCatalog;
                model.User     = bld.UserID;
                model.Password = bld.Password;
                model.Query    = string.Empty;
            }

            return(View(model));
        }