private void button2_Click(object sender, EventArgs e) { string connectionString = "SERVER=localhost;" + "DATABASE=Library;" + "UID=root;" + "PASSWORD= ;"; MySqlConnection connection = new MySqlConnection(connectionString); try { string command = string.Format("Select * From LoginBibl WHERE LB_LOG=\"" + textBox1.Text + "\"" + "AND LB_PASS=\"" + GetCrypt(textBox2.Text) + "\""); MySqlCommand check = new MySqlCommand(command, connection); connection.Open(); if (check.ExecuteScalar() != null) { librEdit user = new librEdit(); user.Show(); this.Close(); } else { MessageBox.Show("Неверный логин или пароль"); } } finally { connection.Close(); } }
private void button2_Click(object sender, EventArgs e) { librEdit user = new librEdit(); user.Show(); this.Close(); }