protected void Button1_Click(object sender, EventArgs e) { Label8.Text = ""; try { int n; if (string.IsNullOrWhiteSpace(TextBox1.Text) || string.IsNullOrWhiteSpace(TextBox2.Text) || string.IsNullOrWhiteSpace(TextBox3.Text) || string.IsNullOrWhiteSpace(TextBox4.Text) || string.IsNullOrWhiteSpace(TextBox5.Text)) { throw new Exception("Health Insurance NO.,First name,Last name,Phone number,Address cannot be empty"); } else if (!int.TryParse(TextBox4.Text, out n)) { throw new Exception("Phone number shoule be an integer"); } ADODatabaseService adodbs = new ADODatabaseService(); Boolean result = adodbs.PatientRegistration(TextBox1.Text, TextBox2.Text, TextBox3.Text, Convert.ToInt32(TextBox4.Text), TextBox5.Text, TextBox6.Text); if (result == true) { Label8.Text = "Saved successfully"; } else { Label8.Text = "Saved failed"; } } catch (Exception ex) { Label8.Text = ex.Message; } }