Beispiel #1
0
        private async void button1_Click(object sender, EventArgs e)
        {
            command = new SqlCommand("SELECT * FROM Employee", conn);

            try
            {
                reader = command.ExecuteReader();
                while (await reader.ReadAsync())
                {
                    if ((textBox1.Text == Convert.ToString(reader["Login"]) &&
                         textBox2.Text == Convert.ToString(reader["Password"])))
                    {
                        Information1 information = new Information1();
                        information.ShowDialog(this);
                        this.Hide();
                    }
                    else
                    {
                        label4.Visible = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), ex.Source.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
        }
Beispiel #2
0
 public Update1(Information1 form, int number)
 {
     InitializeComponent();
     conn = new SqlConnection(connectStr);
     conn.Open();
     reader = null;
     Form   = form;
     if (number == 2)
     {
         Сотрудники.SelectedTab = tabPage2;
     }
     if (number == 3)
     {
         Сотрудники.SelectedTab = tabPage3;
     }
 }