示例#1
0
        private void getProfileData()
        {
            string    conn;
            Connector c = new Connector();
            bool      x = c.testConnection();

            if (x)
            {
                conn = c.getConnector();
                MySqlConnection newConnection = new MySqlConnection(conn);
                MySqlCommand    newCommand    = new MySqlCommand("select * from leavedata.employee where userid='" + this.Username.Text + "';", newConnection);
                MySqlDataReader newReader;
                newConnection.Open();
                newReader = newCommand.ExecuteReader();

                string username = "", name = "", contact = "", address = "", city = "", postcode = "";
                while (newReader.Read())
                {
                    username = newReader.GetString(0);
                    name     = newReader.GetString(1);
                    contact  = newReader.GetString(3);
                    address  = newReader.GetString(4);
                    city     = newReader.GetString(5);
                    postcode = newReader.GetString(6);
                }
                newConnection.Close();
                Profile p = new Profile();
                p.setProfile(username, name, contact, address, city, postcode);
                this.Hide();
                p.Show();
            }
        }
示例#2
0
        private void getProfileData()
        {
            string conn;
            Connector c = new Connector();
            bool x = c.testConnection();
            if (x)
            {
                conn = c.getConnector();
                MySqlConnection newConnection = new MySqlConnection(conn);
                MySqlCommand newCommand = new MySqlCommand("select * from leavedata.employee where userid='" + this.Username.Text + "';", newConnection);
                MySqlDataReader newReader;
                newConnection.Open();
                newReader = newCommand.ExecuteReader();

                string username = "", name = "", contact = "", address = "", city = "", postcode = "";
                while (newReader.Read())
                {
                     username = newReader.GetString(0);
                     name = newReader.GetString(1);
                     contact = newReader.GetString(3);
                     address = newReader.GetString(4);
                     city = newReader.GetString(5);
                     postcode = newReader.GetString(6);
                }
                newConnection.Close();
                Profile p = new Profile();
                p.setProfile(username, name, contact, address, city, postcode);
                this.Hide();
                p.Show();

            }
        }