private void buttonInput_Click(object sender, EventArgs e)
        {
            try
            {
                string loginUser            = textBoxLogin.Text;
                string passwordUser         = textBoxPassword.Text;
                Classes.ClassIniDataBase db = new Classes.ClassIniDataBase();

                DataTable      table       = new DataTable();
                SqlDataAdapter adapter     = new SqlDataAdapter();
                SqlCommand     commandUser = new SqlCommand("SELECT * FROM [User] WHERE login = @uL AND password = @uP AND role= 'user'", db.GetConnection());
                commandUser.Parameters.Add("@uL", SqlDbType.VarChar).Value = loginUser;
                commandUser.Parameters.Add("@uP", SqlDbType.VarChar).Value = passwordUser;
                adapter.SelectCommand = commandUser;
                adapter.Fill(table);
                if (table.Rows.Count > 0)
                {
                    FormMainMenu formMainMenu = new FormMainMenu();
                    formMainMenu.Show();
                }
                else
                {
                    MessageBox.Show("Неверный логин или пароль!");
                }
            }
            finally { }
        }
示例#2
0
        private void buttonBack_Click(object sender, EventArgs e)
        {
            FormMainMenu formMainMenu = new FormMainMenu();

            formMainMenu.ShowDialog();
            this.Hide();
        }