Exemple #1
0
        public bool Connect()
        {
            BaseConst   cb = new BaseConst();
            PrivateData pd = new PrivateData();

            string query = String.Format("{0}={1};{2}={3};{4}={5};{6}={7};",
                                         cb.Server, pd.Server,
                                         cb.Username, pd.Username,
                                         cb.Password, pd.Password,
                                         cb.Database, pd.Database);

            try
            {
                mysql = new MySqlConnection(query);
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }

            //mysql = new MySqlConnection(query);

            //if (mysql == null)
            //    return false;
            //else
            //    return true;
        }
Exemple #2
0
        public DataBase()
        {
            BaseConst   cb = new BaseConst();
            PrivateData pd = new PrivateData();

            string query = String.Format("{0}={1};{2}={3};{4}={5};{6}={7};",
                                         cb.Server, pd.Server,
                                         cb.Username, pd.Username,
                                         cb.Password, pd.Password,
                                         cb.Database, pd.Database);


            mysql = new MySqlConnection(query);
        }
Exemple #3
0
        //methods
        public bool Read()
        {
            BaseConst   cb = new BaseConst();
            PrivateData pd = new PrivateData();

            string query = String.Format("{0}={1};{2}={3};{4}={5};{6}={7};",
                                         cb.Server, pd.Server,
                                         cb.Username, pd.Username,
                                         cb.Password, pd.Password,
                                         cb.Database, pd.Database);

            try
            {
                mysql = new MySqlConnection(query);
                mysql.Open();

                query = "SELECT * FROM `server`";
                MySqlCommand    sqlcmd = new MySqlCommand(query, mysql);
                MySqlDataReader reader = sqlcmd.ExecuteReader();

                while (reader.Read())
                {
                    this.locked    = Boolean.Parse(reader["lock"].ToString());
                    this.working   = Boolean.Parse(reader["work"].ToString());
                    this.address   = reader["address"].ToString();
                    this.password  = reader["password"].ToString();
                    this.teamspeak = reader["teamspeak"].ToString();
                    this.website   = reader["website"].ToString();
                    this.forum     = reader["forum"].ToString();
                    this.youtube   = reader["youtube"].ToString();
                    this.facebook  = reader["facebook"].ToString();
                }

                reader.Close();
                mysql.Close();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemple #4
0
        public bool Connect()
        {
            BaseConst   cb = new BaseConst();
            PrivateData pd = new PrivateData();

            query = String.Format("{0}={1};{2}={3};{4}={5};{6}={7};",
                                  cb.Server, pd.Server,
                                  cb.Username, pd.Username,
                                  cb.Password, pd.Password,
                                  cb.Database, pd.Database);

            this.mysql = new MySqlConnection(query);

            if (this.mysql != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }