private async void DEP_ISERT_OK_Click(object sender, EventArgs e) { if (label23.Visible) { label23.Visible = false; } if (!string.IsNullOrEmpty(DepNameSet.Text) && !string.IsNullOrWhiteSpace(DepNameSet.Text) && !string.IsNullOrEmpty(DepLocSet.Text) && !string.IsNullOrWhiteSpace(DepLocSet.Text)) { SqlCommand command = new SqlCommand("INSERT INTO [Department](Name,Location)Values(@Name, @Location)", sqlconnection); command.Parameters.AddWithValue("Name", DepNameSet.Text); command.Parameters.AddWithValue("Location", DepLocSet.Text); await command.ExecuteNonQueryAsync(); DepLocSet.Clear(); DepNameSet.Clear(); } else { label23.Visible = true; label23.Text = "поля введены не коректно"; } }
private void DEP_ISERT_CANCEL_Click(object sender, EventArgs e) { DepLocSet.Clear(); DepNameSet.Clear(); label23.Visible = false; }