public ClientUser(CommConnection conn)
 {
     this.conn = conn;
     //
     // TODO: 在此加入建構函式的程式碼
     //
 }
        public static CommConnection GetConnection(DataBaseName DBName, ConnectionDBType type)
        {
            String connectionstring = String.Empty;
            String GetDBName        = String.Empty;

            #region Get need used database name

            if (DBName.ToString().StartsWith("Default"))
            {
                GetDBName = DBName.ToString().Replace("Default_", "");
            }
            else
            {
                GetDBName = DBName.ToString().Replace("DB_", "");
            }
            #endregion

            if (type == ConnectionDBType.SqlServer)
            {
                //SQL Server
                connectionstring = String.Format("Data Source={0};Initial Catalog={1};Persist Security Info=True;User ID={2};Password={3};MultipleActiveResultSets=True", Server, GetDBName, Account, Password);
            }

            if (type == ConnectionDBType.OleDB)
            {
                //Access
                String FilePath = Path + "\\_Code\\Database\\MainDB.mdb";
                connectionstring = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};", FilePath);
            }

            if (type == ConnectionDBType.MySql)
            {
                //SQL Server
                connectionstring = String.Format("Network Address={0};Initial Catalog='{1}';Persist Security Info=no;User Name='{2}';Password='******'", Server, GetDBName, Account, Password);
            }

            if (conn == null)
            {
                conn = new CommConnection(connectionstring, type);
                conn.Open();
            }

            if (conn.State != System.Data.ConnectionState.Open)
            {
                conn.Dispose();
                conn = null;
                conn = new CommConnection(connectionstring, type);
                conn.Open();
            }
            return(conn);
        }
        public static CommConnection GetConnection(DataBaseName DBName, ConnectionDBType type)
        {
            String connectionstring = String.Empty;
            String GetDBName = String.Empty;

            #region Get need used database name

            if (DBName.ToString().StartsWith("Default"))
            {
                GetDBName = DBName.ToString().Replace("Default_", "");
            }
            else
            {
                GetDBName = DBName.ToString().Replace("DB_", "");
            }
            #endregion

            if (type == ConnectionDBType.SqlServer)
            {
                //SQL Server
                connectionstring = String.Format("Data Source={0};Initial Catalog={1};Persist Security Info=True;User ID={2};Password={3};MultipleActiveResultSets=True", Server, GetDBName, Account, Password);
            }

            if (type == ConnectionDBType.OleDB)
            {
                //Access
                String FilePath = Path + "\\_Code\\Database\\MainDB.mdb";
                connectionstring = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};", FilePath);
            }

            if (type == ConnectionDBType.MySql)
            {
                //SQL Server
                connectionstring = String.Format("Network Address={0};Initial Catalog='{1}';Persist Security Info=no;User Name='{2}';Password='******'", Server, GetDBName, Account, Password);
            }

            if (conn == null)
            {
                conn = new CommConnection(connectionstring, type);
                conn.Open();
            }

            if (conn.State != System.Data.ConnectionState.Open)
            {
                conn.Dispose();
                conn = null;
                conn = new CommConnection(connectionstring, type);
                conn.Open();
            }
            return conn;
        }