Example #1
0
        private void button7_Click(object sender, EventArgs e)
        {
            this.Hide();
            menu_admins menu2 = new menu_admins();

            menu2.Show();
        }
Example #2
0
        private void INICIO()
        {
            string          connect            = "datasource=localhost;port=3306;username=root;password=;database=xray";
            string          query              = "SELECT * FROM usuarios where nombre = '" + textBox1.Text + "' AND password = ('" + textBox2.Text + "')";
            MySqlConnection databaseConnection = new MySqlConnection(connect);
            MySqlCommand    commandDatabase    = new MySqlCommand(query, databaseConnection);

            commandDatabase.CommandTimeout = 60;
            MySqlDataReader reader;
            string          permiso;

            try
            {
                databaseConnection.Open();
                reader        = commandDatabase.ExecuteReader();
                textBox1.Text = "";
                textBox2.Text = "";

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        string[] row = { reader.GetString(0), reader.GetString(1), reader.GetString(2), reader.GetString(3) };
                        permiso = reader.GetString(3);
                        string nombre = reader.GetString(1);

                        if (permiso == "0")
                        {
                            MessageBox.Show("Bienvenido " + nombre);
                            this.Hide();
                            menu_admins menu1 = new menu_admins();
                            menu1.Show();
                        }
                        else
                        {
                            MessageBox.Show("Sea bienvenido " + nombre);
                            this.Hide();
                            Form4 menu = new Form4();
                            menu.Show();
                        }
                    }
                }
                else
                {
                    label3.Visible = true;
                }
                databaseConnection.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }