protected void Button2_Click(object sender, EventArgs e) { Label8.Text = ""; try { if (string.IsNullOrWhiteSpace(TextBox2.Text) || string.IsNullOrWhiteSpace(TextBox3.Text)) { throw new Exception("First name,Last name cannot be empty"); } ADODatabaseService adodbs = new ADODatabaseService(); string[] result = adodbs.GetPatientInfo(TextBox2.Text, TextBox3.Text); if (result != null) { TextBox1.Text = result[0]; TextBox4.Text = result[1]; TextBox5.Text = result[2]; TextBox6.Text = result[3]; } else { TextBox1.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; TextBox6.Text = ""; Label8.Text = "Not found"; } } catch (Exception ex) { Label8.Text = ex.Message; } }