Beispiel #1
0
        public bool TryTestConn()
        {
            //err = string.Empty;
            if (!string.IsNullOrEmpty(ConnName))
            {
                DalBase helper = DalCreate.CreateDal(ConnName);
                try
                {

                    helper.Con.Open();
                    Version = helper.Con.ServerVersion;
                    if (string.IsNullOrEmpty(Version)) { Version = helper.DataBaseType.ToString(); }
                    helper.Con.Close();
                    IsOK = true;
                    ErrorMsg = string.Empty;
                }
                catch (Exception er)
                {
                    ErrorMsg = er.Message;
                    IsOK = false;
                }
                finally
                {
                    helper.Dispose();
                }
            }
            else
            {
                IsOK = false;
            }
            return IsOK;
        }
Beispiel #2
0
            private static void SetDefault()
            {
                DalBase db = DalCreate.CreateDal(DefaultConn);

                if (db != null)
                {
                    _DefaultDataBaseName = db.DataBaseName;
                    _DefaultDataBaseType = db.DataBaseType;
                    db.Dispose();
                }
            }
Beispiel #3
0
 /// <summary>
 /// Dispose
 /// <para>释放资源</para>
 /// </summary>
 public void Dispose()
 {
     hasDisposed = true;
     if (dalHelper != null)
     {
         if (!dalHelper.IsOnExceptionEventNull)
         {
             dalHelper.OnExceptionEvent -= new DalBase.OnException(helper_OnExceptionEvent);
         }
         _debugInfo = dalHelper.DebugInfo.ToString();
         dalHelper.Dispose();
         dalHelper = null;
     }
 }