예제 #1
0
 /// <summary>
 /// 检查数据库连接参数
 /// </summary>
 /// <returns></returns>
 internal static bool CheckConnectParam(MemoEdit txbBlog, DbConnectParam dbConnectParam)
 {
     if (RegexCheck.IsEmpty(dbConnectParam.DBServer))
     {
         WriteBlog(txbBlog, "---  未指定IP地址");
         return(false);
     }
     else if (!RegexCheck.IsIPv4(dbConnectParam.DBServer))
     {
         WriteBlog(txbBlog, "---  指定的IP地址格式不正确");
         return(false);
     }
     else if (RegexCheck.IsEmpty(dbConnectParam.DbPort))
     {
         WriteBlog(txbBlog, "---  未指定端口号");
         return(false);
     }
     else if (!RegexCheck.IsUint(dbConnectParam.DbPort))
     {
         WriteBlog(txbBlog, "---  指定的端口号格式不正确");
         return(false);
     }
     else if (RegexCheck.IsEmpty(dbConnectParam.DbSid))
     {
         WriteBlog(txbBlog, "---  未指定实例名");
         return(false);
     }
     else if (RegexCheck.IsEmpty(dbConnectParam.DbUser))
     {
         WriteBlog(txbBlog, "---  未指定登陆名");
         return(false);
     }
     else if (RegexCheck.IsEmpty(dbConnectParam.DbPwd))
     {
         WriteBlog(txbBlog, "---  未指定口令");
         return(false);
     }
     else
     {
         return(true);
     }
 }