Ejemplo n.º 1
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            Label7.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();
                DataSet            result = adodbs.GetDoctorInfo(TextBox2.Text, TextBox3.Text);
                if (result != null)
                {
                    TextBox1.Text = result.Tables[0].Rows[0]["Medical Registration NO."].ToString();
                    DropDownList1.SelectedValue = result.Tables[0].Rows[0]["Health Profession"].ToString();
                    TextBox4.Text = result.Tables[0].Rows[0]["Phone number"].ToString();
                    TextBox5.Text = result.Tables[0].Rows[0]["Email"].ToString();
                }
                else
                {
                    TextBox1.Text = "";
                    DropDownList1.SelectedValue = "";
                    TextBox4.Text = "";
                    TextBox5.Text = "";
                    Label7.Text   = "Not found";
                }
            }
            catch (Exception ex)
            {
                Label7.Text = ex.Message;
            }
        }