private void check_employees() { SqlConnection sqlConnection = new SqlConnection(@"Data Source=LIPGIPROMEZ\PROJECTMANAGER;Initial Catalog=InventAuto;Integrated Security=True"); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "SELECT COUNT(Emp_ID) FROM Employees WHERE Emp_ID = '" + txt_ID.Text + "'"; cmd.Connection = sqlConnection; sqlConnection.Open(); //cmd.ExecuteNonQuery(); SqlDataReader rd = cmd.ExecuteReader(); while (rd.Read()) { if (rd.GetInt32(0) == 0) { emp.status = 0; } else { button3.Visible = true; label8.Visible = false; label9.Visible = false; MessageBox.Show("Предупреждение! \n Данное рабочее место уже заведено!"); emp.status = 3; this.TopMost = false; Emp_desicion ed = new Emp_desicion(); ed.ShowDialog(); } } rd.Close(); sqlConnection.Close(); }
private void Button3_Click(object sender, EventArgs e) { this.TopMost = false; Emp_desicion ed = new Emp_desicion(); ed.ShowDialog(); }