protected void Button1_Click(object sender, EventArgs e) { Label7.Text = ""; try { int n; if (string.IsNullOrWhiteSpace(TextBox1.Text) || string.IsNullOrWhiteSpace(TextBox2.Text) || string.IsNullOrWhiteSpace(TextBox3.Text) || string.IsNullOrWhiteSpace(DropDownList1.SelectedValue) || string.IsNullOrWhiteSpace(TextBox4.Text)) { throw new Exception("Health Insurance NO.,First name,Last name,Health Profession,Phone number 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.DoctorRegistration(TextBox1.Text, TextBox2.Text, TextBox3.Text, DropDownList1.SelectedValue, Convert.ToInt32(TextBox4.Text), TextBox5.Text); if (result == true) { Label7.Text = "Saved successfully"; } else { Label7.Text = "Saved failed"; } } catch (Exception ex) { Label7.Text = ex.Message; } }