private void button10_Click(object sender, RoutedEventArgs e) { if (!refresh()) { return; } string postal = t3.Text; string addr = t5.Text; if (!Regex.IsMatch(postal, "^[^()\\*;+='\\\\/]*$") || !Regex.IsMatch(addr, "^[^()\\*;+='\\\\/]*$") || postal.Contains("--") || addr.Contains("--")) { MessageBox.Show("In an attempt to save your changes, invalid characters were detected in the text fields."); return; } try { SqlCommand cmd = new SqlCommand("UPDATE CLIENTS SET postal='" + postal + "', addr='" + addr + "' WHERE id=" + editing.ID.ToString()); cmd.Connection = cn; cmd.ExecuteNonQuery(); editing.Address = addr; editing.Postal = postal; ClientExtra window = new ClientExtra(); window.Show(); this.Hide(); } catch (SqlException) { MessageBox.Show("In an attempt to save your changes, there was an error updating the database: some fields may contain too much text."); } }
private void button_Click(object sender, RoutedEventArgs e) //return { if (goback == "client") { ClientExtra window = new ClientExtra(); window.Show(); this.Hide(); } else if (goback == "account") { AccountExtra window = new AccountExtra(); window.Show(); this.Hide(); } else { if (editing.Approved) { Loans window = new Loans(); window.Show(); this.Hide(); } else { LoansApprove window = new LoansApprove(); window.Show(); this.Hide(); } } }