protected void cmdFind_Click(object sender, EventArgs e) { //creates a new data access layer object. clsDataLayer myDAL = new clsDataLayer(); dsAddress myAddressSet; //call the FindAddress method in the data access layer and store the results in myAddressSet. myAddressSet = (myDAL.FindAddress(Server.MapPath("~/App_Data/AddressBook.mdb"), Convert.ToInt32(txtAddressId.Text))); lblStatus.Text = string.Empty; //if the above operation returns a myAddressSet that is not null and contains a row then display the information in the forms textboxes. if (!(myAddressSet == null) && (myAddressSet.tblAddressBook.Rows.Count != 0)) { this.txtFirstName.Text = myAddressSet.tblAddressBook[0].FirstName.ToString(); this.txtLastName.Text = myAddressSet.tblAddressBook[0].LastName.ToString(); this.txtEmail.Text = myAddressSet.tblAddressBook[0].Email.ToString(); this.txtPhoneNumber.Text = myAddressSet.tblAddressBook[0].PhoneNumber.ToString(); Session.Add("ValidRecord", true); } else { //dislay a message in the status label that no record was found. lblStatus.Text = "No record was found"; Session.Add("ValidRecord", false); } BindGridView(); }