Пример #1
0
        private void Logout_Click(object sender, EventArgs e)
        {
            this.Close();
            var formlogin1 = new formlogin();

            formlogin1.Show();
        }
Пример #2
0
        private void Login_Click(object sender, EventArgs e)
        {
            string valoruser = user.Text;
            string valorpass = pass.Text;
            string valortipo = comboBox1.Text;

            try
            {
                string          MyConnection2 = "datasource=localhost;port=3306;Initial Catalog='c_clinica';username=root;password="******"insert into login(username,password,acesso) values('" + valoruser + "','" + valorpass + "','" + valortipo + "');";
                MySqlConnection MyConn2       = new MySqlConnection(MyConnection2);
                MySqlCommand    MyCommand2    = new MySqlCommand(Query, MyConn2);
                MySqlDataReader MyReader2;
                MyConn2.Open();
                MyReader2 = MyCommand2.ExecuteReader();
                while (MyReader2.Read())
                {
                }
                MyConn2.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            MessageBox.Show("Gravado com Sucesso!", "Informação", MessageBoxButtons.OK, MessageBoxIcon.Information);

            this.Close();
            var formlogin1 = new formlogin();

            formlogin1.Show();
        }