Ejemplo n.º 1
0
        public static string TestDBConn(string data)
        {
            StringBuilder sb      = new StringBuilder();
            string        saveRet = SaveSiteInfo(data);

            if (!string.IsNullOrEmpty(saveRet))
            {
                return(saveRet);
            }
            var conn = new SqlConnection(InitDb.ConnectionStr());

            try
            {
                conn.Open();
            }
            catch (Exception ex)
            {
                conn.Close();
                conn.Dispose();

                sb.Append("数据库连接失败!\r\n" + ex.Message);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }

            return(sb.ToString());
        }
Ejemplo n.º 2
0
        public static string Test(SiteInfo info)
        {
            var sb             = new StringBuilder();
            var upFilesAddress = new  DirectoryInfo(info.UpFilesAddress);

            if (!upFilesAddress.Exists)
            {
                sb.Append("UpFiles目录不存在!\r\n");
            }

            var wFAddress = new DirectoryInfo(info.WFAddress);
            {
                if (!wFAddress.Exists)
                {
                    sb.Append("工作流站点目录不存在!\r\n");
                }
            }

            var conn = new SqlConnection(InitDb.ConnectionStr());

            try
            {
                conn.Open();
            }
            catch (Exception ex)
            {
                conn.Close();
                conn.Dispose();

                sb.Append("数据库连接失败!\r\n");
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }

            return(sb.ToString());
        }